153aa9179Sopenharmony_ciFrom ac746afd33a938b6704ba32824e076af939665fb Mon Sep 17 00:00:00 2001
253aa9179Sopenharmony_ciFrom: Nick Wellnhofer <wellnhofer@aevum.de>
353aa9179Sopenharmony_ciDate: Wed, 15 Feb 2023 13:54:55 +0100
453aa9179Sopenharmony_ciSubject: [PATCH] malloc-fail: Fix memory leak in xmlXPathTryStreamCompile
553aa9179Sopenharmony_ci
653aa9179Sopenharmony_ciFound with libFuzzer, see #344.
753aa9179Sopenharmony_ci
853aa9179Sopenharmony_ciReference:https://github.com/GNOME/libxml2/commit/ac746afd33a938b6704ba32824e076af939665fb
953aa9179Sopenharmony_ciConflict:NA
1053aa9179Sopenharmony_ci---
1153aa9179Sopenharmony_ci xpath.c | 1 +
1253aa9179Sopenharmony_ci 1 file changed, 1 insertion(+)
1353aa9179Sopenharmony_ci
1453aa9179Sopenharmony_cidiff --git a/xpath.c b/xpath.c
1553aa9179Sopenharmony_ciindex c1d119b..7833870 100644
1653aa9179Sopenharmony_ci--- a/xpath.c
1753aa9179Sopenharmony_ci+++ b/xpath.c
1853aa9179Sopenharmony_ci@@ -14121,6 +14121,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
1953aa9179Sopenharmony_ci 	    comp = xmlXPathNewCompExpr();
2053aa9179Sopenharmony_ci 	    if (comp == NULL) {
2153aa9179Sopenharmony_ci 		xmlXPathErrMemory(ctxt, "allocating streamable expression\n");
2253aa9179Sopenharmony_ci+	        xmlFreePattern(stream);
2353aa9179Sopenharmony_ci 		return(NULL);
2453aa9179Sopenharmony_ci 	    }
2553aa9179Sopenharmony_ci 	    comp->stream = stream;
2653aa9179Sopenharmony_ci-- 
2753aa9179Sopenharmony_ci2.27.0
28