1From 282b75f1108e81e483d95a08397da282233f9667 Mon Sep 17 00:00:00 2001 2From: Nick Wellnhofer <wellnhofer@aevum.de> 3Date: Tue, 28 Feb 2023 12:14:33 +0100 4Subject: [PATCH] malloc-fail: Fix memory leak in xmlXPathNameFunction 5 6Found with libFuzzer, see #344. 7 8Reference:https://github.com/GNOME/libxml2/commit/282b75f1108e81e483d95a08397da282233f9667 9Conflict:NA 10--- 11 xpath.c | 5 ++--- 12 1 file changed, 2 insertions(+), 3 deletions(-) 13 14diff --git a/xpath.c b/xpath.c 15index d17ad5e..56a59c1 100644 16--- a/xpath.c 17+++ b/xpath.c 18@@ -8857,9 +8857,8 @@ xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs) 19 NULL, 0); 20 if (fullname == cur->nodesetval->nodeTab[i]->name) 21 fullname = xmlStrdup(cur->nodesetval->nodeTab[i]->name); 22- if (fullname == NULL) { 23- XP_ERROR(XPATH_MEMORY_ERROR); 24- } 25+ if (fullname == NULL) 26+ xmlXPathPErrMemory(ctxt, NULL); 27 valuePush(ctxt, xmlXPathCacheWrapString( 28 ctxt->context, fullname)); 29 } 30-- 312.27.0 32 33