OLD | NEW |
(Empty) | |
| 1 From df83c17e5a2646bd923f75e5e507bc80d73c9722 Mon Sep 17 00:00:00 2001 |
| 2 From: Daniel Veillard <veillard@redhat.com> |
| 3 Date: Wed, 17 Nov 2010 13:12:14 +0000 |
| 4 Subject: Fix a potential freeing error in XPath |
| 5 |
| 6 --- |
| 7 diff --git a/xpath.c b/xpath.c |
| 8 index 81e33f6..1447be5 100644 |
| 9 --- a/xpath.c |
| 10 +++ b/xpath.c |
| 11 @@ -11763,11 +11763,15 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserCo
ntextPtr ctxt, |
| 12 |
| 13 if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { |
| 14 xmlXPathObjectPtr tmp; |
| 15 - /* pop the result */ |
| 16 + /* pop the result if any */ |
| 17 tmp = valuePop(ctxt); |
| 18 - xmlXPathReleaseObject(xpctxt, tmp); |
| 19 - /* then pop off contextObj, which will be freed later */ |
| 20 - valuePop(ctxt); |
| 21 + if (tmp != contextObj) |
| 22 + /* |
| 23 + * Free up the result |
| 24 + * then pop off contextObj, which will be freed later |
| 25 + */ |
| 26 + xmlXPathReleaseObject(xpctxt, tmp); |
| 27 + valuePop(ctxt); |
| 28 goto evaluation_error; |
| 29 } |
| 30 |
| 31 -- |
| 32 cgit v0.8.3.1 |
OLD | NEW |