libxml2/backport-Fix-memory-leak-in-xmlLoadEntityContent-error-path.patch
zhuofeng feb7e8218d backport upstream patches
(cherry picked from commit ec64ed27a9add0f7a9bf6ee351ad67302a60c383)
2023-06-20 11:16:46 +08:00

34 lines
830 B
Diff

From ca2c91f139426f63646292da58a15a1511dccc0f Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 28 Jun 2022 19:24:14 +0200
Subject: [PATCH] Fix memory leak in xmlLoadEntityContent error path
Free the input stream if pushing it fails.
Found by OSS-Fuzz.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=43743
Reference:https://github.com/GNOME/libxml2/commit/ca2c91f139426f63646292da58a15a1511dccc0f
Conflict:NA
---
parser.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/parser.c b/parser.c
index d8225bd..dd507c0 100644
--- a/parser.c
+++ b/parser.c
@@ -8102,6 +8102,7 @@ xmlLoadEntityContent(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
*/
if (xmlPushInput(ctxt, input) < 0) {
xmlBufferFree(buf);
+ xmlFreeInputStream(input);
return(-1);
}
--
2.27.0