• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From ac746afd33a938b6704ba32824e076af939665fb Mon Sep 17 00:00:00 2001
2From: Nick Wellnhofer <wellnhofer@aevum.de>
3Date: Wed, 15 Feb 2023 13:54:55 +0100
4Subject: [PATCH] malloc-fail: Fix memory leak in xmlXPathTryStreamCompile
5
6Found with libFuzzer, see #344.
7
8Reference:https://github.com/GNOME/libxml2/commit/ac746afd33a938b6704ba32824e076af939665fb
9Conflict:NA
10---
11 xpath.c | 1 +
12 1 file changed, 1 insertion(+)
13
14diff --git a/xpath.c b/xpath.c
15index c1d119b..7833870 100644
16--- a/xpath.c
17+++ b/xpath.c
18@@ -14121,6 +14121,7 @@ xmlXPathTryStreamCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {
19 	    comp = xmlXPathNewCompExpr();
20 	    if (comp == NULL) {
21 		xmlXPathErrMemory(ctxt, "allocating streamable expression\n");
22+	        xmlFreePattern(stream);
23 		return(NULL);
24 	    }
25 	    comp->stream = stream;
26--
272.27.0
28