[libxslt] Fix memory leak in xsltCompileIdKeyPattern



commit 2d71b9e86d12733f48451fb5623eedd92ea05919
Author: David King <dking redhat com>
Date:   Fri May 21 11:23:26 2021 +0100

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

 libxslt/pattern.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index 532f3bb2..1944661c 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -1348,6 +1348,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
        if (ctxt->error) {
            xsltTransformError(NULL, NULL, NULL,
                    "xsltCompileIdKeyPattern : Literal expected\n");
+           xmlFree(lit);
            return;
        }
        SKIP_BLANKS;
@@ -1374,6 +1375,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
        if (ctxt->error) {
            xsltTransformError(NULL, NULL, NULL,
                    "xsltCompileIdKeyPattern : Literal expected\n");
+           xmlFree(lit);
            return;
        }
        SKIP_BLANKS;
@@ -1415,6 +1417,7 @@ xsltCompileIdKeyPattern(xsltParserContextPtr ctxt, xmlChar *name,
            if (ctxt->error) {
                xsltTransformError(NULL, NULL, NULL,
                        "xsltCompileIdKeyPattern : Literal expected\n");
+                xmlFree(lit);
                return;
            }
            SKIP_BLANKS;


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