[libxml2] Fix memory leak in xmlRelaxNGNewDocParserCtxt



commit 477f6de3947309c9da45a9dd5dc129c639c0dc44
Author: David King <amigadave amigadave com>
Date:   Wed Jul 14 15:35:31 2021 +0100

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

 relaxng.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/relaxng.c b/relaxng.c
index 04cb55ec..c4c26cb0 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -6839,6 +6839,7 @@ xmlRelaxNGNewDocParserCtxt(xmlDocPtr doc)
         (xmlRelaxNGParserCtxtPtr) xmlMalloc(sizeof(xmlRelaxNGParserCtxt));
     if (ret == NULL) {
         xmlRngPErrMemory(NULL, "building parser\n");
+        xmlFreeDoc(copy);
         return (NULL);
     }
     memset(ret, 0, sizeof(xmlRelaxNGParserCtxt));


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