• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From c82701ff0b24bc56c6814e690198599cfc8c273a Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Tue, 14 Feb 2023 15:13:06 +0100
4Subject: [PATCH] malloc-fail: Fix memory leak in xmlDocDumpFormatMemoryEnc
5
6Found with libFuzzer, see #344.
7
8Reference:https://github.com/GNOME/libxml2/commit/c82701ff0b24bc56c6814e690198599cfc8c273a
9Conflict:NA
10---
11 xmlsave.c | 1 +
12 1 file changed, 1 insertion(+)
13
14diff --git a/xmlsave.c b/xmlsave.c
15index 489505f..90e1856 100644
16--- a/xmlsave.c
17+++ b/xmlsave.c
18@@ -2402,6 +2402,7 @@ xmlDocDumpFormatMemoryEnc(xmlDocPtr out_doc, xmlChar **doc_txt_ptr,
19
20     if ((out_buff = xmlAllocOutputBuffer(conv_hdlr)) == NULL ) {
21         xmlSaveErrMemory("creating buffer");
22+        xmlCharEncCloseFunc(conv_hdlr);
23         return;
24     }
25
26--
272.27.0
28
29
30