summaryrefslogtreecommitdiffstats
path: root/third_party/libxml/src/xpath.c
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/libxml/src/xpath.c')
-rw-r--r--third_party/libxml/src/xpath.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/third_party/libxml/src/xpath.c b/third_party/libxml/src/xpath.c
index 5d3474e..b0a9c60 100644
--- a/third_party/libxml/src/xpath.c
+++ b/third_party/libxml/src/xpath.c
@@ -11752,11 +11752,15 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
xmlXPathObjectPtr tmp;
- /* pop the result */
+ /* pop the result if any */
tmp = valuePop(ctxt);
- xmlXPathReleaseObject(xpctxt, tmp);
- /* then pop off contextObj, which will be freed later */
- valuePop(ctxt);
+ if (tmp != contextObj)
+ /*
+ * Free up the result
+ * then pop off contextObj, which will be freed later
+ */
+ xmlXPathReleaseObject(xpctxt, tmp);
+ valuePop(ctxt);
goto evaluation_error;
}