Compilers are not very good at detecting this problem. Fixed by manual inspection of compilation warnings after replacing 'VIR_FREE' with an empty macro. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/locking/sanlock_helper.c | 2 -- src/logging/log_daemon.c | 2 -- src/nwfilter/nwfilter_ebiptables_driver.c | 2 -- src/openvz/openvz_driver.c | 2 -- src/security/security_selinux.c | 2 -- src/test/test_driver.c | 2 -- src/util/virstorageencryption.c | 4 ---- src/util/virsysinfo.c | 2 -- src/vmware/vmware_conf.c | 4 ---- src/vmware/vmware_driver.c | 4 ---- tests/networkxml2firewalltest.c | 2 -- tests/xmconfigtest.c | 2 -- tools/virsh-checkpoint.c | 2 -- 13 files changed, 32 deletions(-) diff --git a/src/locking/sanlock_helper.c b/src/locking/sanlock_helper.c index 50deccfd67..26f225e639 100644 --- a/src/locking/sanlock_helper.c +++ b/src/locking/sanlock_helper.c @@ -50,7 +50,6 @@ main(int argc, char **argv) const char *uri; const char *uuid; virDomainLockFailureAction action; - char *xml = NULL; virConnectPtr conn = NULL; virDomainPtr dom = NULL; int ret = EXIT_FAILURE; @@ -102,7 +101,6 @@ main(int argc, char **argv) virObjectUnref(dom); if (conn) virConnectClose(conn); - VIR_FREE(xml); return ret; } diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 7017db2dcc..028f771f14 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -526,7 +526,6 @@ virLogDaemonPreExecRestart(const char *state_file, char *state = NULL; virJSONValuePtr object = virJSONValueNewObject(); char *magic; - virHashKeyValuePairPtr pairs = NULL; VIR_DEBUG("Running pre-restart exec"); @@ -577,7 +576,6 @@ virLogDaemonPreExecRestart(const char *state_file, abort(); /* This should be impossible to reach */ cleanup: - VIR_FREE(pairs); VIR_FREE(state); virJSONValueFree(object); return -1; diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 235a002495..6fc8044c8d 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -3368,7 +3368,6 @@ ebiptablesApplyNewRules(const char *ifname, bool haveEbtables = false; bool haveIptables = false; bool haveIp6tables = false; - char *errmsg = NULL; struct ebtablesSubChainInst **subchains = NULL; size_t nsubchains = 0; int ret = -1; @@ -3568,7 +3567,6 @@ ebiptablesApplyNewRules(const char *ifname, virHashFree(chains_in_set); virHashFree(chains_out_set); - VIR_FREE(errmsg); return ret; } diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index 0a08c63b1b..79a100c343 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -145,7 +145,6 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef) { int ret = -1; int vpsid; - char * confdir = NULL; virCommandPtr cmd = NULL; if (vmdef->nfss > 1) { @@ -194,7 +193,6 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef) ret = 0; cleanup: - VIR_FREE(confdir); virCommandFree(cmd); return ret; diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index e6819af26c..7359a45a96 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -812,7 +812,6 @@ virSecuritySELinuxGenLabel(virSecurityManagerPtr mgr, { int rc = -1; char *mcs = NULL; - char *scontext = NULL; context_t ctx = NULL; const char *range; virSecurityLabelDefPtr seclabel; @@ -949,7 +948,6 @@ virSecuritySELinuxGenLabel(virSecurityManagerPtr mgr, if (ctx) context_free(ctx); - VIR_FREE(scontext); VIR_FREE(mcs); VIR_FREE(sens); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 0dc91e1577..7a1db21718 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -8977,7 +8977,6 @@ testDomainCheckpointCreateXML(virDomainPtr domain, { testDriverPtr privconn = domain->conn->privateData; virDomainObjPtr vm = NULL; - char *xml = NULL; virDomainMomentObjPtr chk = NULL; virDomainCheckpointPtr checkpoint = NULL; virDomainMomentObjPtr current = NULL; @@ -9064,7 +9063,6 @@ testDomainCheckpointCreateXML(virDomainPtr domain, } virDomainObjEndAPI(&vm); - VIR_FREE(xml); return checkpoint; } diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c index 34c356b5a3..94ccaf1e9a 100644 --- a/src/util/virstorageencryption.c +++ b/src/util/virstorageencryption.c @@ -146,8 +146,6 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt); virStorageEncryptionSecretPtr ret; char *type_str = NULL; - char *uuidstr = NULL; - char *usagestr = NULL; if (VIR_ALLOC(ret) < 0) return NULL; @@ -177,8 +175,6 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt, cleanup: VIR_FREE(type_str); virStorageEncryptionSecretFree(ret); - VIR_FREE(uuidstr); - VIR_FREE(usagestr); return NULL; } diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index dc052a7311..52e576f129 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -770,7 +770,6 @@ virSysinfoParseX86BaseBoard(const char *base, char *eol = NULL; virSysinfoBaseBoardDefPtr boards = NULL; size_t nboards = 0; - char *board_type = NULL; while (base && (cur = strstr(base, "Base Board Information"))) { virSysinfoBaseBoardDefPtr def; @@ -845,7 +844,6 @@ virSysinfoParseX86BaseBoard(const char *base, while (nboards--) virSysinfoBaseBoardDefClear(&boards[nboards]); VIR_FREE(boards); - VIR_FREE(board_type); return ret; } diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index 8bea9c3b12..e44673247f 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -132,8 +132,6 @@ vmwareLoadDomains(struct vmware_driver *driver) char *vmxPath = NULL; char *vmx = NULL; vmwareDomainPtr pDomain; - char *directoryName = NULL; - char *fileName = NULL; int ret = -1; virVMXContext ctx; char *outbuf = NULL; @@ -197,8 +195,6 @@ vmwareLoadDomains(struct vmware_driver *driver) virCommandFree(cmd); VIR_FREE(outbuf); virDomainDefFree(vmdef); - VIR_FREE(directoryName); - VIR_FREE(fileName); VIR_FREE(vmx); virObjectUnref(vm); return ret; diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 5b4057a8f6..e82edf2a11 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -400,8 +400,6 @@ vmwareDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla virDomainObjPtr vm = NULL; virDomainPtr dom = NULL; char *vmx = NULL; - char *directoryName = NULL; - char *fileName = NULL; char *vmxPath = NULL; vmwareDomainPtr pDomain = NULL; virVMXContext ctx; @@ -461,8 +459,6 @@ vmwareDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla cleanup: virDomainDefFree(vmdef); VIR_FREE(vmx); - VIR_FREE(directoryName); - VIR_FREE(fileName); VIR_FREE(vmxPath); if (vm) virObjectUnlock(vm); diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c index 0ad5e2303b..7b5ada7faa 100644 --- a/tests/networkxml2firewalltest.c +++ b/tests/networkxml2firewalltest.c @@ -61,7 +61,6 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmdline, const char *baseargs) { - char *expectargv = NULL; char *actualargv = NULL; virBuffer buf = VIR_BUFFER_INITIALIZER; virNetworkDefPtr def = NULL; @@ -94,7 +93,6 @@ static int testCompareXMLToArgvFiles(const char *xml, cleanup: virBufferFreeAndReset(&buf); - VIR_FREE(expectargv); VIR_FREE(actualargv); virNetworkDefFree(def); return ret; diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c index 6bd18d0fe1..e4a2b39384 100644 --- a/tests/xmconfigtest.c +++ b/tests/xmconfigtest.c @@ -129,7 +129,6 @@ testCompareHelper(const void *data) const struct testInfo *info = data; char *xml = NULL; char *cfg = NULL; - char *cfgout = NULL; xml = g_strdup_printf("%s/xmconfigdata/test-%s.xml", abs_srcdir, info->name); cfg = g_strdup_printf("%s/xmconfigdata/test-%s.cfg", abs_srcdir, info->name); @@ -141,7 +140,6 @@ testCompareHelper(const void *data) VIR_FREE(xml); VIR_FREE(cfg); - VIR_FREE(cfgout); return result; } diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index e82a67f075..853fe05fc4 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -471,7 +471,6 @@ cmdCheckpointInfo(vshControl *ctl, virDomainCheckpointPtr checkpoint = NULL; const char *name; char *parent = NULL; - char *xml = NULL; xmlDocPtr xmldoc = NULL; xmlXPathContextPtr ctxt = NULL; bool ret = false; @@ -518,7 +517,6 @@ cmdCheckpointInfo(vshControl *ctl, cleanup: xmlXPathFreeContext(ctxt); xmlFreeDoc(xmldoc); - VIR_FREE(xml); VIR_FREE(parent); virshDomainCheckpointFree(checkpoint); virshDomainFree(dom); -- 2.26.2