提交 ffc810b7 编写于 作者: P Pavel Hrdina

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: NPavel Hrdina <phrdina@redhat.com>
上级 87d97a9d
......@@ -1582,7 +1582,6 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
for (i = 0, m = 0; i < n; i++) {
xmlNodePtr node = nodes[i];
char *tmp = virXMLPropString(node, "type");
virNodeDevDevnodeType type;
int val;
if (!tmp) {
......@@ -1591,15 +1590,17 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
goto error;
}
if ((val = virNodeDevDevnodeTypeFromString(tmp)) < 0) {
val = virNodeDevDevnodeTypeFromString(tmp);
if (val < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown devnode type '%s'"), tmp);
VIR_FREE(tmp);
goto error;
}
type = val;
VIR_FREE(tmp);
switch (type) {
switch ((virNodeDevDevnodeType)val) {
case VIR_NODE_DEV_DEVNODE_DEV:
def->devnode = (char*)xmlNodeGetContent(node);
break;
......
......@@ -471,6 +471,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
port);
goto cleanup;
}
VIR_FREE(port);
}
}
}
......
......@@ -521,6 +521,8 @@ virSysinfoParseS390Processor(const char *base, virSysinfoDefPtr ret)
&processor->processor_family,
'=', '\n'))
goto cleanup;
VIR_FREE(procline);
}
result = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册