summaryrefslogtreecommitdiff
path: root/xpath.c
diff options
context:
space:
mode:
authorMike Hommey <glandium@debian.org>2007-08-26 10:54:57 +0200
committerMike Hommey <glandium@debian.org>2007-08-26 10:54:57 +0200
commit2b6861bb726172b0a9946e7d31ff4ca163bae6df (patch)
tree3e66058a45f841a1155d57ee239f663535eb6bfe /xpath.c
parent36cccb83804d8cbd041066d7610c137329e16878 (diff)
parentc69572cb9f2467259a73de64c08e141f21f17fa8 (diff)
downloadlibxml2-debian/2.6.30.dfsg-1.tar.gz
New upstream releasedebian/2.6.30.dfsg-1
Diffstat (limited to 'xpath.c')
-rw-r--r--xpath.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/xpath.c b/xpath.c
index 8f6545a..22a3f9d 100644
--- a/xpath.c
+++ b/xpath.c
@@ -3057,7 +3057,8 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
precedence1 = 2; /* element is parent */
node1 = node1->parent;
}
- if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE)) {
+ if ((node1 == NULL) || (node1->type != XML_ELEMENT_NODE) ||
+ (0 <= (long) node1->content)) {
/*
* Fallback for whatever case.
*/
@@ -3194,11 +3195,6 @@ xmlXPathCmpNodesExt(xmlNodePtr node1, xmlNodePtr node2) {
turtle_comparison:
- if (miscNode1 != NULL)
- node1 = miscNode1;
- if (miscNode2 != NULL)
- node2 = miscNode2;
-
if (node1 == node2->prev)
return(1);
if (node1 == node2->next)
@@ -11710,8 +11706,15 @@ xmlXPathCompOpEvalPositionalPredicate(xmlXPathParserContextPtr ctxt,
valuePush(ctxt, contextObj);
res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1);
- if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1))
+ if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
+ xmlXPathObjectPtr tmp;
+ /* pop the result */
+ tmp = valuePop(ctxt);
+ xmlXPathReleaseObject(xpctxt, tmp);
+ /* then pop off contextObj, which will be freed later */
+ valuePop(ctxt);
goto evaluation_error;
+ }
if (res)
pos++;