diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-26 16:54:05 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-26 16:55:37 +0100 |
commit | 5fea8c7ebe21721464f7167c9624e4d457158fa8 (patch) | |
tree | 8bb4f770f5cb76adaa154e4d2334e98574346c24 | |
parent | 282bb94471cbb29fb46bbfb06d716071bb4c3816 (diff) | |
download | libxslt-5fea8c7ebe21721464f7167c9624e4d457158fa8.tar.gz |
malloc-fail: Fix memory leak in xsltParseStylesheetPreserveSpace
Found with libFuzzer, see #84.
-rw-r--r-- | libxslt/xslt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libxslt/xslt.c b/libxslt/xslt.c index 55ccca3d..3a45b62d 100644 --- a/libxslt/xslt.c +++ b/libxslt/xslt.c @@ -1554,8 +1554,10 @@ xsltParseStylesheetPreserveSpace(xsltStylesheetPtr style, xmlNodePtr cur) { if (style->stripSpaces == NULL) style->stripSpaces = xmlHashCreate(10); - if (style->stripSpaces == NULL) + if (style->stripSpaces == NULL) { + xmlFree(elements); return; + } element = elements; while (*element != 0) { |