mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-03-23 02:50:08 +03:00
SAX2: Check return value of xmlPushInput
Fix null deref in case of malloc failure.
This commit is contained in:
parent
38195cf596
commit
1e5375c1b4
14
SAX2.c
14
SAX2.c
@ -320,18 +320,13 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
||||
xmlMalloc(5 * sizeof(xmlParserInputPtr));
|
||||
if (ctxt->inputTab == NULL) {
|
||||
xmlSAX2ErrMemory(ctxt);
|
||||
xmlFreeInputStream(input);
|
||||
ctxt->input = oldinput;
|
||||
ctxt->inputNr = oldinputNr;
|
||||
ctxt->inputMax = oldinputMax;
|
||||
ctxt->inputTab = oldinputTab;
|
||||
ctxt->encoding = oldencoding;
|
||||
return;
|
||||
goto error;
|
||||
}
|
||||
ctxt->inputNr = 0;
|
||||
ctxt->inputMax = 5;
|
||||
ctxt->input = NULL;
|
||||
xmlPushInput(ctxt, input);
|
||||
if (xmlPushInput(ctxt, input) < 0)
|
||||
goto error;
|
||||
|
||||
if (input->filename == NULL)
|
||||
input->filename = (char *) xmlCanonicPath(SystemID);
|
||||
@ -364,7 +359,8 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name,
|
||||
else
|
||||
ctxt->sizeentities += consumed;
|
||||
|
||||
xmlFreeInputStream(ctxt->input);
|
||||
error:
|
||||
xmlFreeInputStream(input);
|
||||
xmlFree(ctxt->inputTab);
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user