• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 97086fd76b21fee6e41c13921c450411442d9da6 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Tue, 14 Feb 2023 14:45:58 +0100
4Subject: [PATCH] malloc-fail: Fix memory leak in xmlParserInputBufferCreateMem
5
6Found with libFuzzer, see #344.
7
8Reference:https://github.com/GNOME/libxml2/commit/97086fd76b21fee6e41c13921c450411442d9da6
9Conflict:NA
10---
11 xmlIO.c | 2 +-
12 1 file changed, 1 insertion(+), 1 deletion(-)
13
14diff --git a/xmlIO.c b/xmlIO.c
15index 71c9fbf..edf31e8 100644
16--- a/xmlIO.c
17+++ b/xmlIO.c
18@@ -2953,7 +2953,7 @@ xmlParserInputBufferCreateMem(const char *mem, int size, xmlCharEncoding enc) {
19 	ret->closecallback = NULL;
20 	errcode = xmlBufAdd(ret->buffer, (const xmlChar *) mem, size);
21 	if (errcode != 0) {
22-	    xmlFree(ret);
23+	    xmlFreeParserInputBuffer(ret);
24 	    return(NULL);
25 	}
26     }
27--
282.27.0
29
30
31