[libxml2] Fix memory leak in libxml_C14NDocSaveTo
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix memory leak in libxml_C14NDocSaveTo
- Date: Sun, 16 Jan 2022 15:02:04 +0000 (UTC)
commit 9a9dd31ba60bdf4d15c7739958551c05b6d754cb
Author: David King <amigadave amigadave com>
Date: Wed Jul 14 15:28:56 2021 +0100
Fix memory leak in libxml_C14NDocSaveTo
Found by Coverity.
https://bugzilla.redhat.com/show_bug.cgi?id=1938806
python/libxml.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/python/libxml.c b/python/libxml.c
index 9196b620..e6a9e9f3 100644
--- a/python/libxml.c
+++ b/python/libxml.c
@@ -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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]