[libxslt] Fix memory leak in pattern compilation error path



commit 15edbe4090afb075bb02c748ce0ce956b09e0ad0
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Jul 8 11:37:50 2019 +0200

    Fix memory leak in pattern compilation error path
    
    In xsltCompileLocationPathPattern, return early in case of error.
    Otherwise, xsltCompileIdKeyPattern could be called with an error
    condition already signaled leading to a memory leak.
    
    Found by OSS-Fuzz.

 libxslt/pattern.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index fc52b88c..c448beec 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -1875,6 +1875,8 @@ xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) {
            xsltCompileIdKeyPattern(ctxt, name, 1, novar, 0);
            xmlFree(name);
            name = NULL;
+            if (ctxt->error)
+                return;
            if ((CUR == '/') && (NXT(1) == '/')) {
                PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar);
                NEXT;


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