mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
Fix a possible NULL dereference
https://bugzilla.gnome.org/show_bug.cgi?id=705400 In case of allocation error the pointer was dereferenced before the test for a failure
This commit is contained in:
4
SAX2.c
4
SAX2.c
@@ -994,12 +994,12 @@ xmlSAX2StartDocument(void *ctx)
|
|||||||
#ifdef LIBXML_HTML_ENABLED
|
#ifdef LIBXML_HTML_ENABLED
|
||||||
if (ctxt->myDoc == NULL)
|
if (ctxt->myDoc == NULL)
|
||||||
ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
|
ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
|
||||||
ctxt->myDoc->properties = XML_DOC_HTML;
|
|
||||||
ctxt->myDoc->parseFlags = ctxt->options;
|
|
||||||
if (ctxt->myDoc == NULL) {
|
if (ctxt->myDoc == NULL) {
|
||||||
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
|
xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ctxt->myDoc->properties = XML_DOC_HTML;
|
||||||
|
ctxt->myDoc->parseFlags = ctxt->options;
|
||||||
#else
|
#else
|
||||||
xmlGenericError(xmlGenericErrorContext,
|
xmlGenericError(xmlGenericErrorContext,
|
||||||
"libxml2 built without HTML support\n");
|
"libxml2 built without HTML support\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user