1 --- misc/libxml2-2.7.6/xpath.c 2009-09-24 17:32:00.000000000 +0200
2 +++ misc/build/libxml2-2.7.6/xpath.c 2011-01-03 17:21:08.788256100 +0100
5 xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
6 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
7 - if (cur != NULL && cur->children != NULL)
8 - return cur->children ;
9 - if (cur == NULL) cur = ctxt->context->node;
10 + if ((cur != NULL) && (cur->type != XML_ATTRIBUTE_NODE) &&
11 + (cur->type != XML_NAMESPACE_DECL) && (cur->children != NULL))
12 + return(cur->children);
15 + cur = ctxt->context->node;
16 + if (cur->type == XML_NAMESPACE_DECL)
18 + if (cur->type == XML_ATTRIBUTE_NODE)
21 if (cur == NULL) return(NULL) ; /* ERROR */
22 if (cur->next != NULL) return(cur->next) ;
24 @@ -8162,8 +8170,13 @@
25 xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur)
27 if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL);
30 cur = ctxt->context->node;
31 + if (cur->type == XML_NAMESPACE_DECL)
33 + if (cur->type == XML_ATTRIBUTE_NODE)
34 + return(cur->parent);
38 if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
40 cur = ctxt->context->node;
43 - if (cur->type == XML_NAMESPACE_DECL)
44 - cur = (xmlNodePtr)((xmlNsPtr)cur)->next;
45 + if (cur->type == XML_NAMESPACE_DECL)
47 ctxt->ancestor = cur->parent;
49 if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE))
50 @@ -11737,11 +11750,16 @@
52 if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) {
53 xmlXPathObjectPtr tmp;
54 - /* pop the result */
55 + /* pop the result if any */
57 - xmlXPathReleaseObject(xpctxt, tmp);
58 - /* then pop off contextObj, which will be freed later */
60 + if (tmp != contextObj) {
62 + * Free up the result
63 + * then pop off contextObj, which will be freed later
65 + xmlXPathReleaseObject(xpctxt, tmp);
68 goto evaluation_error;