• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 1a90087543485763d8e6124a1818e10637e512ae Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Wed, 2 Nov 2022 16:05:05 +0100
4Subject: [PATCH 09/28] malloc-fail: Fix memory leak in xmlSAX2ExternalSubset
5
6Found with libFuzzer, see #344.
7
8Reference: https://github.com/GNOME/libxml2/commit/7ceaee9430ca24bda7f2480f387dbebfc259002a
9Conflict: NA
10---
11 SAX2.c | 1 +
12 1 file changed, 1 insertion(+)
13
14diff --git a/SAX2.c b/SAX2.c
15index 9801393..96bbcb3 100644
16--- a/SAX2.c
17+++ b/SAX2.c
18@@ -436,6 +436,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
19 	                 xmlMalloc(5 * sizeof(xmlParserInputPtr));
20 	if (ctxt->inputTab == NULL) {
21 	    xmlSAX2ErrMemory(ctxt, "xmlSAX2ExternalSubset");
22+            xmlFreeInputStream(input);
23 	    ctxt->input = oldinput;
24 	    ctxt->inputNr = oldinputNr;
25 	    ctxt->inputMax = oldinputMax;
26--
272.27.0
28
29