]> granicus.if.org Git - php/commitdiff
Fixed bug #31361 (simplexml/domxml segfault when adding node twice)
authorRob Richards <rrichards@php.net>
Sun, 2 Jan 2005 12:08:41 +0000 (12:08 +0000)
committerRob Richards <rrichards@php.net>
Sun, 2 Jan 2005 12:08:41 +0000 (12:08 +0000)
ext/libxml/libxml.c

index 6fd7506414da5e58934685f1a98c17a49d9b5d19..16cc1aa40aa33e1f9cc34b534d6e51652c7b1585 100644 (file)
@@ -725,6 +725,10 @@ void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC
                ret_refcount = php_libxml_decrement_node_ptr(object TSRMLS_CC);
                if (ret_refcount == 0) {
                        php_libxml_node_free_resource(nodep TSRMLS_CC);
+               } else {
+                       if (obj_node && object == obj_node->_private) {
+                               obj_node->_private = NULL;
+                       }
                }
                /* Safe to call as if the resource were freed then doc pointer is NULL */
                php_libxml_decrement_doc_ref(object TSRMLS_CC);