mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 11:35:19 +00:00
Remove use of variables passed only to 'VIR_FREE'
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com
This commit is contained in:
parent
515e62b32b
commit
e0cf04ffd6
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user