mirror of https://gitee.com/openkylin/libvirt.git
Fix possible memory leak in util/virxml.c
A "xmlstr" string may not be assigned into a "doc" pointer and it could cause memory leak. To fix it if the "doc" pointer is NULL and the "xmlstr" string is not assigned we should free it. This has been found by coverity. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
788e6cb25b
commit
67fbf129fc
|
@ -1047,6 +1047,8 @@ virXMLExtractNamespaceXML(xmlNodePtr root,
|
||||||
cleanup:
|
cleanup:
|
||||||
if (doc)
|
if (doc)
|
||||||
*doc = xmlstr;
|
*doc = xmlstr;
|
||||||
|
else
|
||||||
|
VIR_FREE(xmlstr);
|
||||||
xmlFreeNode(nodeCopy);
|
xmlFreeNode(nodeCopy);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue