mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-23 01:52:48 +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:
11
parser.c
11
parser.c
@@ -11633,7 +11633,8 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size,
|
||||
* @filename is used as base URI to fetch external entities and for
|
||||
* error reports.
|
||||
*
|
||||
* Returns the new parser context or NULL in case of error.
|
||||
* Returns the new parser context or NULL if a memory allocation
|
||||
* failed.
|
||||
*/
|
||||
|
||||
xmlParserCtxtPtr
|
||||
@@ -11649,7 +11650,7 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
|
||||
ctxt->options &= ~XML_PARSE_NODICT;
|
||||
ctxt->dictNames = 1;
|
||||
|
||||
input = xmlNewInputPush(ctxt, filename, chunk, size, NULL);
|
||||
input = xmlInputCreatePush(filename, chunk, size);
|
||||
if (input == NULL) {
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
@@ -13348,11 +13349,15 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk,
|
||||
|
||||
xmlCtxtReset(ctxt);
|
||||
|
||||
input = xmlNewInputPush(ctxt, filename, chunk, size, encoding);
|
||||
input = xmlInputCreatePush(filename, chunk, size);
|
||||
if (input == NULL)
|
||||
return(1);
|
||||
|
||||
inputPush(ctxt, input);
|
||||
|
||||
if (encoding != NULL)
|
||||
xmlSwitchEncodingName(ctxt, encoding);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user