diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2019-07-08 11:37:50 +0200 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2019-07-08 11:37:50 +0200 |
commit | 15edbe4090afb075bb02c748ce0ce956b09e0ad0 (patch) | |
tree | 2666900af9e34e81e818fe26bd0579ed48cc82ac | |
parent | 6ce8de69330783977dd14f6569419489875fb71b (diff) | |
download | libxslt-15edbe4090afb075bb02c748ce0ce956b09e0ad0.tar.gz |
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.
-rw-r--r-- | libxslt/pattern.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; |