prevent some unchecked pointer accesses, patch by Jake Goulding daniel
authorDaniel Veillard <veillard@src.gnome.org>
Tue, 7 Oct 2008 16:26:24 +0000 (16:26 +0000)
committerDaniel Veillard <veillard@src.gnome.org>
Tue, 7 Oct 2008 16:26:24 +0000 (16:26 +0000)
* libxslt/pattern.c: prevent some unchecked pointer accesses, patch
  by Jake Goulding
daniel

svn path=/trunk/; revision=1491

ChangeLog
libxslt/pattern.c

index 846ef33..a349006 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Oct  7 18:16:08 CEST 2008 Daniel Veillard <veillard@redhat.com>
+
+       * libxslt/pattern.c: prevent some unchecked pointer accesses, patch
+         by Jake Goulding
+
 Wed Aug  6 20:10:08 HKT 2008 William Brack <wbrack@mmm.com.hk>
 
        * Minor cleanup of "typo" and some compilation warnings:
index 419fa3d..815013b 100644 (file)
@@ -984,8 +984,10 @@ restart:
                        /*
                         * recompute the index
                         */
-                       xmlNodePtr siblings = node->parent->children;
                        xmlNodePtr parent = node->parent;
+                       xmlNodePtr siblings = NULL;
+
+                        if (parent) siblings = parent->children;
 
                        while (siblings != NULL) {
                            if (siblings->type == XML_ELEMENT_NODE) {
@@ -1088,8 +1090,10 @@ restart:
                        /*
                         * recompute the index
                         */
-                       xmlNodePtr siblings = node->parent->children;
                        xmlNodePtr parent = node->parent;
+                       xmlNodePtr siblings = NULL;
+
+                        if (parent) siblings = parent->children;
 
                        while (siblings != NULL) {
                            if (siblings->type == XML_ELEMENT_NODE) {