summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2023-02-26 16:53:53 +0100
committerNick Wellnhofer <wellnhofer@aevum.de>2023-02-26 16:55:37 +0100
commit3c146ac14962359c4ff7aed81a24ebd9e82c52f5 (patch)
tree742294bb5c494c0406f63caae372b11cd4dac732
parentdcf822256b70b38c6d39446f2f66e2debfec33a3 (diff)
downloadlibxslt-3c146ac14962359c4ff7aed81a24ebd9e82c52f5.tar.gz
malloc-fail: Fix memory leak in xsltParseStylesheetOutput
Found with libFuzzer, see #84.
-rw-r--r--libxslt/xslt.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libxslt/xslt.c b/libxslt/xslt.c
index 12489640..55ccca3d 100644
--- a/libxslt/xslt.c
+++ b/libxslt/xslt.c
@@ -1313,8 +1313,10 @@ xsltParseStylesheetOutput(xsltStylesheetPtr style, xmlNodePtr cur)
if (elements != NULL) {
if (style->cdataSection == NULL)
style->cdataSection = xmlHashCreate(10);
- if (style->cdataSection == NULL)
+ if (style->cdataSection == NULL) {
+ xmlFree(elements);
return;
+ }
element = elements;
while (*element != 0) {