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

parser: Don't report malloc failures when creating context

We don't want messages to stderr before an error handler could be set on
a parser context.
This commit is contained in:
Nick Wellnhofer
2024-06-11 16:19:58 +02:00
parent ef8dc4f673
commit 89fcae4dfd
4 changed files with 21 additions and 26 deletions

View File

@@ -5817,13 +5817,17 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
return(NULL);
encoding = xmlGetCharEncodingName(enc);
input = xmlNewInputPush(ctxt, filename, chunk, size, encoding);
input = xmlInputCreatePush(filename, chunk, size);
if (input == NULL) {
htmlFreeParserCtxt(ctxt);
return(NULL);
}
inputPush(ctxt, input);
if (encoding != NULL)
xmlSwitchEncodingName(ctxt, encoding);
return(ctxt);
}
#endif /* LIBXML_PUSH_ENABLED */