[libxml2] Fix memory leaks in xmlParseStartTag2 error paths



commit b48226f78c626a0fdbaed65793f1a6138de8558f
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Jan 7 17:58:32 2019 +0100

    Fix memory leaks in xmlParseStartTag2 error paths
    
    Found by OSS-Fuzz.

 parser.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/parser.c b/parser.c
index c424412f..5879d3bc 100644
--- a/parser.c
+++ b/parser.c
@@ -9247,7 +9247,8 @@ xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref,
                 xmlErrMemory(ctxt, "dictionary allocation failure");
                 if ((attvalue != NULL) && (alloc != 0))
                     xmlFree(attvalue);
-                return(NULL);
+                localname = NULL;
+                goto done;
             }
             if (*URL != 0) {
                 uri = xmlParseURI((const char *) URL);
@@ -9497,7 +9498,8 @@ next_attr:
 
                    if ((atts == NULL) || (nbatts + 5 > maxatts)) {
                        if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) {
-                           return(NULL);
+                            localname = NULL;
+                            goto done;
                        }
                        maxatts = ctxt->maxatts;
                        atts = ctxt->atts;


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