mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-14 16:45:20 +00:00
src: fix multiple resource leaks in loops
All of the variables are filled inside a loop and therefore needs to be also freed in every cycle. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> (cherry picked from commit ffc810b7c7cad514fe362c5b42877bca7eee88b3)
This commit is contained in:
parent
fdd08607c2
commit
c714afcc99
@ -1582,7 +1582,6 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
for (i = 0, m = 0; i < n; i++) {
|
for (i = 0, m = 0; i < n; i++) {
|
||||||
xmlNodePtr node = nodes[i];
|
xmlNodePtr node = nodes[i];
|
||||||
char *tmp = virXMLPropString(node, "type");
|
char *tmp = virXMLPropString(node, "type");
|
||||||
virNodeDevDevnodeType type;
|
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
@ -1591,15 +1590,17 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((val = virNodeDevDevnodeTypeFromString(tmp)) < 0) {
|
val = virNodeDevDevnodeTypeFromString(tmp);
|
||||||
|
|
||||||
|
if (val < 0) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("unknown devnode type '%s'"), tmp);
|
_("unknown devnode type '%s'"), tmp);
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
type = val;
|
VIR_FREE(tmp);
|
||||||
|
|
||||||
switch (type) {
|
switch ((virNodeDevDevnodeType)val) {
|
||||||
case VIR_NODE_DEV_DEVNODE_DEV:
|
case VIR_NODE_DEV_DEVNODE_DEV:
|
||||||
def->devnode = (char*)xmlNodeGetContent(node);
|
def->devnode = (char*)xmlNodeGetContent(node);
|
||||||
break;
|
break;
|
||||||
|
@ -471,6 +471,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
|
|||||||
port);
|
port);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
VIR_FREE(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -521,6 +521,8 @@ virSysinfoParseS390Processor(const char *base, virSysinfoDefPtr ret)
|
|||||||
&processor->processor_family,
|
&processor->processor_family,
|
||||||
'=', '\n'))
|
'=', '\n'))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
VIR_FREE(procline);
|
||||||
}
|
}
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user