1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

Fix memory leak in xmlParseBalancedChunkMemoryRecover

When doc is NULL, namespace created in xmlTreeEnsureXMLDecl
is bind to newDoc->oldNs, in this case, set newDoc->oldNs to
NULL and free newDoc will cause a memory leak.

Found with libFuzzer.

Closes #82.
This commit is contained in:
Zhipeng Xie
2019-08-07 17:39:17 +08:00
committed by Nick Wellnhofer
parent 09b6f8183d
commit 5a02583c7e

View File

@@ -13894,6 +13894,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
xmlFreeParserCtxt(ctxt);
newDoc->intSubset = NULL;
newDoc->extSubset = NULL;
if(doc != NULL)
newDoc->oldNs = NULL;
xmlFreeDoc(newDoc);