• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From bc7740b3c30e1517dcf53a084766c74d25db222f Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Thu, 16 Feb 2023 11:45:58 +0100
4Subject: [PATCH] malloc-fail: Fix memory leak in xmlCopyPropList
5
6Found with libFuzzer, see #344.
7
8Reference:https://github.com/GNOME/libxml2/commit/bc7740b3c30e1517dcf53a084766c74d25db222f
9Conflict:NA
10---
11 tree.c | 4 +++-
12 1 file changed, 3 insertions(+), 1 deletion(-)
13
14diff --git a/tree.c b/tree.c
15index ac156e1..35bd948 100644
16--- a/tree.c
17+++ b/tree.c
18@@ -4190,8 +4190,10 @@ xmlCopyPropList(xmlNodePtr target, xmlAttrPtr cur) {
19         return(NULL);
20     while (cur != NULL) {
21         q = xmlCopyProp(target, cur);
22-	if (q == NULL)
23+	if (q == NULL) {
24+            xmlFreePropList(ret);
25 	    return(NULL);
26+        }
27 	if (p == NULL) {
28 	    ret = p = q;
29 	} else {
30--
312.27.0
32
33