mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-26 00:37:43 +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:
committed by
Nick Wellnhofer
parent
09b6f8183d
commit
5a02583c7e
3
parser.c
3
parser.c
@@ -13894,7 +13894,8 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax,
|
|||||||
xmlFreeParserCtxt(ctxt);
|
xmlFreeParserCtxt(ctxt);
|
||||||
newDoc->intSubset = NULL;
|
newDoc->intSubset = NULL;
|
||||||
newDoc->extSubset = NULL;
|
newDoc->extSubset = NULL;
|
||||||
newDoc->oldNs = NULL;
|
if(doc != NULL)
|
||||||
|
newDoc->oldNs = NULL;
|
||||||
xmlFreeDoc(newDoc);
|
xmlFreeDoc(newDoc);
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
|
|||||||
Reference in New Issue
Block a user