summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2019-07-08 11:37:50 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2019-07-08 11:37:50 +0200
commit15edbe4090afb075bb02c748ce0ce956b09e0ad0 (patch)
tree2666900af9e34e81e818fe26bd0579ed48cc82ac
parent6ce8de69330783977dd14f6569419489875fb71b (diff)
downloadlibxslt-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.c2
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;