mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
parser: Check return value of inputPush
inputPush typically doesn't fail because we pre-allocate the input table. The return value should be checked nevertheless.
This commit is contained in:
24
HTMLparser.c
24
HTMLparser.c
@@ -5033,7 +5033,11 @@ htmlCreateMemoryParserCtxtInternal(const char *url,
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
inputPush(ctxt, input);
|
||||
if (inputPush(ctxt, input) < 0) {
|
||||
xmlFreeInputStream(input);
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(ctxt);
|
||||
}
|
||||
@@ -5086,7 +5090,11 @@ htmlCreateDocParserCtxt(const xmlChar *str, const char *url,
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
inputPush(ctxt, input);
|
||||
if (inputPush(ctxt, input) < 0) {
|
||||
xmlFreeInputStream(input);
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(ctxt);
|
||||
}
|
||||
@@ -5815,7 +5823,11 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
inputPush(ctxt, input);
|
||||
if (inputPush(ctxt, input) < 0) {
|
||||
xmlFreeInputStream(input);
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
if (encoding != NULL)
|
||||
xmlSwitchEncodingName(ctxt, encoding);
|
||||
@@ -5921,7 +5933,11 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding)
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
inputPush(ctxt, input);
|
||||
if (inputPush(ctxt, input) < 0) {
|
||||
xmlFreeInputStream(input);
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
return(ctxt);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user