[libxml2] Fix memory leak in xmlNewInputFromFile



commit 328456bf29b32897bcfcc13f106ec4f975ac5d8a
Author: David King <amigadave amigadave com>
Date:   Wed Jul 14 14:43:59 2021 +0100

    Fix memory leak in xmlNewInputFromFile
    
    Found by Coverity.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1938806

 parserInternals.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/parserInternals.c b/parserInternals.c
index cbcfde0e..c5c0b16d 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -1546,8 +1546,10 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
     }
 
     inputStream = xmlNewInputStream(ctxt);
-    if (inputStream == NULL)
+    if (inputStream == NULL) {
+       xmlFreeParserInputBuffer(buf);
        return(NULL);
+    }
 
     inputStream->buf = buf;
     inputStream = xmlCheckHTTPInput(ctxt, inputStream);


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