1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-20 03:52:25 +03:00

Fix memory leak in libxml_C14NDocSaveTo

Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1938806
This commit is contained in:
David King
2021-07-14 15:28:56 +01:00
committed by Nick Wellnhofer
parent d68c163723
commit 9a9dd31ba6

View File

@@ -3725,7 +3725,10 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
buf = xmlOutputBufferCreateFile(output, NULL);
result = PyxmlNodeSet_Convert(pyobj_nodes, &nodes);
if (result < 0) return NULL;
if (result < 0) {
xmlOutputBufferClose(buf);
return NULL;
}
if (exclusive) {
result = PystringSet_Convert(pyobj_prefixes, &prefixes);
@@ -3734,6 +3737,7 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self,
xmlFree(nodes->nodeTab);
xmlFree(nodes);
}
xmlOutputBufferClose(buf);
return NULL;
}
}