[libxml2] Fix a possible NULL dereference



commit a885f13a675d449e06529f9e68a6826acf45e19c
Author: Gaurav <g gupta 40samsung com>
Date:   Sat Aug 3 22:16:02 2013 +0800

    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

 SAX2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/SAX2.c b/SAX2.c
index 4adf202..33d167e 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -994,12 +994,12 @@ xmlSAX2StartDocument(void *ctx)
 #ifdef LIBXML_HTML_ENABLED
        if (ctxt->myDoc == NULL)
            ctxt->myDoc = htmlNewDocNoDtD(NULL, NULL);
-       ctxt->myDoc->properties = XML_DOC_HTML;
-       ctxt->myDoc->parseFlags = ctxt->options;
        if (ctxt->myDoc == NULL) {
            xmlSAX2ErrMemory(ctxt, "xmlSAX2StartDocument");
            return;
        }
+       ctxt->myDoc->properties = XML_DOC_HTML;
+       ctxt->myDoc->parseFlags = ctxt->options;
 #else
         xmlGenericError(xmlGenericErrorContext,
                "libxml2 built without HTML support\n");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]