diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-26 16:53:57 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2023-02-26 16:55:37 +0100 |
commit | b5e338b396b2a002dced88a88a866a548f084741 (patch) | |
tree | dbf4bf6b947607d5a864a6fedbeedebfb3c48cf7 | |
parent | 212e43452f6e4c716ea781be90122f88b5dd956e (diff) | |
download | libxslt-b5e338b396b2a002dced88a88a866a548f084741.tar.gz |
malloc-fail: Fix memory leak in xsltSaveResultToString
Found with libFuzzer, see #84.
-rw-r--r-- | libxslt/xsltutils.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c index 39b1b9fd..59dd192d 100644 --- a/libxslt/xsltutils.c +++ b/libxslt/xsltutils.c @@ -1828,6 +1828,8 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len, (const xmlChar *) "UTF-8"))) encoder = NULL; buf = xmlAllocOutputBuffer(encoder); + if (buf == NULL) + xmlCharEncCloseFunc(encoder); } else { buf = xmlAllocOutputBuffer(NULL); } |