libxml2/backport-Avoid-double-free-if-malloc-fails-in-inputPush.patch
zhuofeng feb7e8218d backport upstream patches
(cherry picked from commit ec64ed27a9add0f7a9bf6ee351ad67302a60c383)
2023-06-20 11:16:46 +08:00

33 lines
920 B
Diff

From ecba4cbd4335b31aa7a815701971ed09cfffea9b Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Tue, 28 Jun 2022 19:22:31 +0200
Subject: [PATCH] Avoid double-free if malloc fails in inputPush
It's the caller's responsibility to free the input stream if this
function fails.
Reference:https://github.com/GNOME/libxml2/commit/ecba4cbd4335b31aa7a815701971ed09cfffea9b
Conflict:NA
---
parser.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/parser.c b/parser.c
index 0d5bcc1..d8225bd 100644
--- a/parser.c
+++ b/parser.c
@@ -1763,9 +1763,7 @@ inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value)
sizeof(ctxt->inputTab[0]));
if (ctxt->inputTab == NULL) {
xmlErrMemory(ctxt, NULL);
- xmlFreeInputStream(value);
ctxt->inputMax /= 2;
- value = NULL;
return (-1);
}
}
--
2.27.0