1From a5787229e5c53d522364cd68397cdc61094ac51a Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Sun, 5 Mar 2023 14:09:34 +0100
4Subject: [PATCH] malloc-fail: Fix 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 | 4 ++--
12 1 file changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/xmlschemas.c b/xmlschemas.c
15index 724920b..9ace2b7 100644
16--- a/xmlschemas.c
17+++ b/xmlschemas.c
18@@ -3658,12 +3658,12 @@ xmlSchemaBucketCreate(xmlSchemaParserCtxtPtr pctxt,
19     ret->type = type;
20     ret->globals = xmlSchemaItemListCreate();
21     if (ret->globals == NULL) {
22-	xmlFree(ret);
23+	xmlSchemaBucketFree(ret);
24 	return(NULL);
25     }
26     ret->locals = xmlSchemaItemListCreate();
27     if (ret->locals == NULL) {
28-	xmlFree(ret);
29+	xmlSchemaBucketFree(ret);
30 	return(NULL);
31     }
32     /*
33-- 
342.27.0
35
36