[libxml2] Fix memory leak in parser error path



commit 8627e4ed207571d2647ac3e28fb18e03f9326ad9
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Tue May 23 18:11:08 2017 +0200

    Fix memory leak in parser error path
    
    Triggered in mixed content ELEMENT declarations if there's an invalid
    name after the first valid name:
    
        <!ELEMENT para (#PCDATA|a|<invalid>)*>
    
    Found with libFuzzer and ASan.

 parser.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/parser.c b/parser.c
index c2c812d..fd242aa 100644
--- a/parser.c
+++ b/parser.c
@@ -6272,7 +6272,7 @@ xmlParseElementMixedContentDecl(xmlParserCtxtPtr ctxt, int inputchk) {
            if (elem == NULL) {
                xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED,
                        "xmlParseElementMixedContentDecl : Name expected\n");
-               xmlFreeDocElementContent(ctxt->myDoc, cur);
+               xmlFreeDocElementContent(ctxt->myDoc, ret);
                return(NULL);
            }
            SKIP_BLANKS;


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