1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

schemas: Fix memory leak in xmlSchemaValidateStream

Regressed in 9a82b94a.

Fixes #530.
This commit is contained in:
Nick Wellnhofer 2023-04-30 21:30:21 +02:00
parent 0ffc2d82b5
commit 57d88da675

View File

@ -29098,9 +29098,18 @@ xmlSchemaValidateStream(xmlSchemaValidCtxtPtr ctxt,
/*
* prepare the parser
*/
pctxt = xmlNewSAXParserCtxt(sax, user_data);
if (pctxt == NULL)
return (-1);
if (sax != NULL) {
pctxt = xmlNewSAXParserCtxt(sax, user_data);
if (pctxt == NULL)
return (-1);
} else {
pctxt = xmlNewParserCtxt();
if (pctxt == NULL)
return (-1);
/* We really want pctxt->sax to be NULL here. */
xmlFree(pctxt->sax);
pctxt->sax = NULL;
}
#if 0
if (options)
xmlCtxtUseOptions(pctxt, options);