[libxslt] Fix memory leak in xsltDocumentElem



commit 7e74460c9a781ec7dc08cc2d3a2341baf0435e2b
Author: David King <dking redhat com>
Date:   Fri May 21 11:27:53 2021 +0100

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

 libxslt/transform.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/libxslt/transform.c b/libxslt/transform.c
index 3aba354f..57f05bf7 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -3631,8 +3631,10 @@ xsltDocumentElem(xsltTransformContextPtr ctxt, xmlNodePtr node,
     if (elements != NULL) {
        if (style->stripSpaces == NULL)
            style->stripSpaces = xmlHashCreate(10);
-       if (style->stripSpaces == NULL)
+       if (style->stripSpaces == NULL) {
+           xmlFree(elements);
            return;
+       }
 
        element = elements;
        while (*element != 0) {


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