• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 260d6b8d77d11a20a2614eef99e88e68eaca6550 Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Sun, 5 Mar 2023 14:10:26 +0100
4Subject: [PATCH] malloc-fail: Fix another memory leak in xmlSchemaBucketCreate
5
6Found with libFuzzer, see #344.
7
8Reference:https://github.com/GNOME/libxml2/commit/260d6b8d77d11a20a2614eef99e88e68eaca6550
9Conflict:NA
10---
11 xmlschemas.c | 5 ++++-
12 1 file changed, 4 insertions(+), 1 deletion(-)
13
14diff --git a/xmlschemas.c b/xmlschemas.c
15index fa9d113..06bf664 100644
16--- a/xmlschemas.c
17+++ b/xmlschemas.c
18@@ -3742,7 +3742,10 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
19 		return(NULL);
20 	    }
21 	}
22-	xmlSchemaItemListAdd(mainSchema->includes, ret);
23+	if (xmlSchemaItemListAdd(mainSchema->includes, ret) < 0) {
24+	    xmlSchemaBucketFree(ret);
25+	    return(NULL);
26+        }
27     }
28     /*
29     * Add to list of all buckets; this is used for lookup
30--
312.27.0
32
33