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 *uri;
|
||||||
const char *uuid;
|
const char *uuid;
|
||||||
virDomainLockFailureAction action;
|
virDomainLockFailureAction action;
|
||||||
char *xml = NULL;
|
|
||||||
virConnectPtr conn = NULL;
|
virConnectPtr conn = NULL;
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
int ret = EXIT_FAILURE;
|
int ret = EXIT_FAILURE;
|
||||||
@ -102,7 +101,6 @@ main(int argc, char **argv)
|
|||||||
virObjectUnref(dom);
|
virObjectUnref(dom);
|
||||||
if (conn)
|
if (conn)
|
||||||
virConnectClose(conn);
|
virConnectClose(conn);
|
||||||
VIR_FREE(xml);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -526,7 +526,6 @@ virLogDaemonPreExecRestart(const char *state_file,
|
|||||||
char *state = NULL;
|
char *state = NULL;
|
||||||
virJSONValuePtr object = virJSONValueNewObject();
|
virJSONValuePtr object = virJSONValueNewObject();
|
||||||
char *magic;
|
char *magic;
|
||||||
virHashKeyValuePairPtr pairs = NULL;
|
|
||||||
|
|
||||||
VIR_DEBUG("Running pre-restart exec");
|
VIR_DEBUG("Running pre-restart exec");
|
||||||
|
|
||||||
@ -577,7 +576,6 @@ virLogDaemonPreExecRestart(const char *state_file,
|
|||||||
abort(); /* This should be impossible to reach */
|
abort(); /* This should be impossible to reach */
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(pairs);
|
|
||||||
VIR_FREE(state);
|
VIR_FREE(state);
|
||||||
virJSONValueFree(object);
|
virJSONValueFree(object);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -3368,7 +3368,6 @@ ebiptablesApplyNewRules(const char *ifname,
|
|||||||
bool haveEbtables = false;
|
bool haveEbtables = false;
|
||||||
bool haveIptables = false;
|
bool haveIptables = false;
|
||||||
bool haveIp6tables = false;
|
bool haveIp6tables = false;
|
||||||
char *errmsg = NULL;
|
|
||||||
struct ebtablesSubChainInst **subchains = NULL;
|
struct ebtablesSubChainInst **subchains = NULL;
|
||||||
size_t nsubchains = 0;
|
size_t nsubchains = 0;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -3568,7 +3567,6 @@ ebiptablesApplyNewRules(const char *ifname,
|
|||||||
virHashFree(chains_in_set);
|
virHashFree(chains_in_set);
|
||||||
virHashFree(chains_out_set);
|
virHashFree(chains_out_set);
|
||||||
|
|
||||||
VIR_FREE(errmsg);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,6 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
|
|||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int vpsid;
|
int vpsid;
|
||||||
char * confdir = NULL;
|
|
||||||
virCommandPtr cmd = NULL;
|
virCommandPtr cmd = NULL;
|
||||||
|
|
||||||
if (vmdef->nfss > 1) {
|
if (vmdef->nfss > 1) {
|
||||||
@ -194,7 +193,6 @@ static int openvzSetInitialConfig(virDomainDefPtr vmdef)
|
|||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(confdir);
|
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -812,7 +812,6 @@ virSecuritySELinuxGenLabel(virSecurityManagerPtr mgr,
|
|||||||
{
|
{
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
char *mcs = NULL;
|
char *mcs = NULL;
|
||||||
char *scontext = NULL;
|
|
||||||
context_t ctx = NULL;
|
context_t ctx = NULL;
|
||||||
const char *range;
|
const char *range;
|
||||||
virSecurityLabelDefPtr seclabel;
|
virSecurityLabelDefPtr seclabel;
|
||||||
@ -949,7 +948,6 @@ virSecuritySELinuxGenLabel(virSecurityManagerPtr mgr,
|
|||||||
|
|
||||||
if (ctx)
|
if (ctx)
|
||||||
context_free(ctx);
|
context_free(ctx);
|
||||||
VIR_FREE(scontext);
|
|
||||||
VIR_FREE(mcs);
|
VIR_FREE(mcs);
|
||||||
VIR_FREE(sens);
|
VIR_FREE(sens);
|
||||||
|
|
||||||
|
@ -8977,7 +8977,6 @@ testDomainCheckpointCreateXML(virDomainPtr domain,
|
|||||||
{
|
{
|
||||||
testDriverPtr privconn = domain->conn->privateData;
|
testDriverPtr privconn = domain->conn->privateData;
|
||||||
virDomainObjPtr vm = NULL;
|
virDomainObjPtr vm = NULL;
|
||||||
char *xml = NULL;
|
|
||||||
virDomainMomentObjPtr chk = NULL;
|
virDomainMomentObjPtr chk = NULL;
|
||||||
virDomainCheckpointPtr checkpoint = NULL;
|
virDomainCheckpointPtr checkpoint = NULL;
|
||||||
virDomainMomentObjPtr current = NULL;
|
virDomainMomentObjPtr current = NULL;
|
||||||
@ -9064,7 +9063,6 @@ testDomainCheckpointCreateXML(virDomainPtr domain,
|
|||||||
}
|
}
|
||||||
|
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
VIR_FREE(xml);
|
|
||||||
return checkpoint;
|
return checkpoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +146,6 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
|
|||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
VIR_XPATH_NODE_AUTORESTORE(ctxt);
|
||||||
virStorageEncryptionSecretPtr ret;
|
virStorageEncryptionSecretPtr ret;
|
||||||
char *type_str = NULL;
|
char *type_str = NULL;
|
||||||
char *uuidstr = NULL;
|
|
||||||
char *usagestr = NULL;
|
|
||||||
|
|
||||||
if (VIR_ALLOC(ret) < 0)
|
if (VIR_ALLOC(ret) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -177,8 +175,6 @@ virStorageEncryptionSecretParse(xmlXPathContextPtr ctxt,
|
|||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(type_str);
|
VIR_FREE(type_str);
|
||||||
virStorageEncryptionSecretFree(ret);
|
virStorageEncryptionSecretFree(ret);
|
||||||
VIR_FREE(uuidstr);
|
|
||||||
VIR_FREE(usagestr);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +770,6 @@ virSysinfoParseX86BaseBoard(const char *base,
|
|||||||
char *eol = NULL;
|
char *eol = NULL;
|
||||||
virSysinfoBaseBoardDefPtr boards = NULL;
|
virSysinfoBaseBoardDefPtr boards = NULL;
|
||||||
size_t nboards = 0;
|
size_t nboards = 0;
|
||||||
char *board_type = NULL;
|
|
||||||
|
|
||||||
while (base && (cur = strstr(base, "Base Board Information"))) {
|
while (base && (cur = strstr(base, "Base Board Information"))) {
|
||||||
virSysinfoBaseBoardDefPtr def;
|
virSysinfoBaseBoardDefPtr def;
|
||||||
@ -845,7 +844,6 @@ virSysinfoParseX86BaseBoard(const char *base,
|
|||||||
while (nboards--)
|
while (nboards--)
|
||||||
virSysinfoBaseBoardDefClear(&boards[nboards]);
|
virSysinfoBaseBoardDefClear(&boards[nboards]);
|
||||||
VIR_FREE(boards);
|
VIR_FREE(boards);
|
||||||
VIR_FREE(board_type);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,8 +132,6 @@ vmwareLoadDomains(struct vmware_driver *driver)
|
|||||||
char *vmxPath = NULL;
|
char *vmxPath = NULL;
|
||||||
char *vmx = NULL;
|
char *vmx = NULL;
|
||||||
vmwareDomainPtr pDomain;
|
vmwareDomainPtr pDomain;
|
||||||
char *directoryName = NULL;
|
|
||||||
char *fileName = NULL;
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virVMXContext ctx;
|
virVMXContext ctx;
|
||||||
char *outbuf = NULL;
|
char *outbuf = NULL;
|
||||||
@ -197,8 +195,6 @@ vmwareLoadDomains(struct vmware_driver *driver)
|
|||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
VIR_FREE(outbuf);
|
VIR_FREE(outbuf);
|
||||||
virDomainDefFree(vmdef);
|
virDomainDefFree(vmdef);
|
||||||
VIR_FREE(directoryName);
|
|
||||||
VIR_FREE(fileName);
|
|
||||||
VIR_FREE(vmx);
|
VIR_FREE(vmx);
|
||||||
virObjectUnref(vm);
|
virObjectUnref(vm);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -400,8 +400,6 @@ vmwareDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
|||||||
virDomainObjPtr vm = NULL;
|
virDomainObjPtr vm = NULL;
|
||||||
virDomainPtr dom = NULL;
|
virDomainPtr dom = NULL;
|
||||||
char *vmx = NULL;
|
char *vmx = NULL;
|
||||||
char *directoryName = NULL;
|
|
||||||
char *fileName = NULL;
|
|
||||||
char *vmxPath = NULL;
|
char *vmxPath = NULL;
|
||||||
vmwareDomainPtr pDomain = NULL;
|
vmwareDomainPtr pDomain = NULL;
|
||||||
virVMXContext ctx;
|
virVMXContext ctx;
|
||||||
@ -461,8 +459,6 @@ vmwareDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int fla
|
|||||||
cleanup:
|
cleanup:
|
||||||
virDomainDefFree(vmdef);
|
virDomainDefFree(vmdef);
|
||||||
VIR_FREE(vmx);
|
VIR_FREE(vmx);
|
||||||
VIR_FREE(directoryName);
|
|
||||||
VIR_FREE(fileName);
|
|
||||||
VIR_FREE(vmxPath);
|
VIR_FREE(vmxPath);
|
||||||
if (vm)
|
if (vm)
|
||||||
virObjectUnlock(vm);
|
virObjectUnlock(vm);
|
||||||
|
@ -61,7 +61,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
const char *cmdline,
|
const char *cmdline,
|
||||||
const char *baseargs)
|
const char *baseargs)
|
||||||
{
|
{
|
||||||
char *expectargv = NULL;
|
|
||||||
char *actualargv = NULL;
|
char *actualargv = NULL;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
virNetworkDefPtr def = NULL;
|
virNetworkDefPtr def = NULL;
|
||||||
@ -94,7 +93,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
VIR_FREE(expectargv);
|
|
||||||
VIR_FREE(actualargv);
|
VIR_FREE(actualargv);
|
||||||
virNetworkDefFree(def);
|
virNetworkDefFree(def);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -129,7 +129,6 @@ testCompareHelper(const void *data)
|
|||||||
const struct testInfo *info = data;
|
const struct testInfo *info = data;
|
||||||
char *xml = NULL;
|
char *xml = NULL;
|
||||||
char *cfg = NULL;
|
char *cfg = NULL;
|
||||||
char *cfgout = NULL;
|
|
||||||
|
|
||||||
xml = g_strdup_printf("%s/xmconfigdata/test-%s.xml", abs_srcdir, info->name);
|
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);
|
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(xml);
|
||||||
VIR_FREE(cfg);
|
VIR_FREE(cfg);
|
||||||
VIR_FREE(cfgout);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -471,7 +471,6 @@ cmdCheckpointInfo(vshControl *ctl,
|
|||||||
virDomainCheckpointPtr checkpoint = NULL;
|
virDomainCheckpointPtr checkpoint = NULL;
|
||||||
const char *name;
|
const char *name;
|
||||||
char *parent = NULL;
|
char *parent = NULL;
|
||||||
char *xml = NULL;
|
|
||||||
xmlDocPtr xmldoc = NULL;
|
xmlDocPtr xmldoc = NULL;
|
||||||
xmlXPathContextPtr ctxt = NULL;
|
xmlXPathContextPtr ctxt = NULL;
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
@ -518,7 +517,6 @@ cmdCheckpointInfo(vshControl *ctl,
|
|||||||
cleanup:
|
cleanup:
|
||||||
xmlXPathFreeContext(ctxt);
|
xmlXPathFreeContext(ctxt);
|
||||||
xmlFreeDoc(xmldoc);
|
xmlFreeDoc(xmldoc);
|
||||||
VIR_FREE(xml);
|
|
||||||
VIR_FREE(parent);
|
VIR_FREE(parent);
|
||||||
virshDomainCheckpointFree(checkpoint);
|
virshDomainCheckpointFree(checkpoint);
|
||||||
virshDomainFree(dom);
|
virshDomainFree(dom);
|
||||||
|
Loading…
Reference in New Issue
Block a user