diff options
Diffstat (limited to 'xpath.c')
-rw-r--r-- | xpath.c | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -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++; |