1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-25 10:50:08 +03:00

parser: Fix memory leak after malloc failure in xml*ParseDTD

This commit is contained in:
Nick Wellnhofer 2024-07-15 13:03:55 +02:00
parent 69f12d6d47
commit fee0006a06

View File

@ -11819,6 +11819,7 @@ xmlIOParseDTD(xmlSAXHandlerPtr sax, xmlParserInputBufferPtr input,
* plug some encoding conversion routines here.
*/
if (xmlPushInput(ctxt, pinput) < 0) {
xmlFreeInputStream(pinput);
xmlFreeParserCtxt(ctxt);
return(NULL);
}
@ -11920,6 +11921,7 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID,
* plug some encoding conversion routines here.
*/
if (xmlPushInput(ctxt, input) < 0) {
xmlFreeInputStream(input);
xmlFreeParserCtxt(ctxt);
if (systemIdCanonic != NULL)
xmlFree(systemIdCanonic);