Fix memory leak in xmlXIncludeLoadDoc error path

Found by OSS-Fuzz.
This commit is contained in:
Nick Wellnhofer 2020-05-30 15:32:25 +02:00
parent a230b728f1
commit ff009f9913

View File

@ -1608,6 +1608,7 @@ loaded:
XML_XINCLUDE_XPTR_RESULT,
"XPointer is not a range: #%s\n",
fragment);
xmlXPathFreeObject(xptr);
xmlXPathFreeContext(xptrctxt);
xmlFree(URL);
xmlFree(fragment);
@ -1615,6 +1616,7 @@ loaded:
case XPATH_NODESET:
if ((xptr->nodesetval == NULL) ||
(xptr->nodesetval->nodeNr <= 0)) {
xmlXPathFreeObject(xptr);
xmlXPathFreeContext(xptrctxt);
xmlFree(URL);
xmlFree(fragment);