From: Rob Richards Date: Sun, 2 Jan 2005 12:09:09 +0000 (+0000) Subject: MFH: Fixed bug #31361 (simplexml/domxml segfault when adding node twice) X-Git-Tag: php-5.0.4RC1~399 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ac69c47a4ceb5f237285760222fa8b63c9c2735;p=php MFH: Fixed bug #31361 (simplexml/domxml segfault when adding node twice) --- diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index fcdd54c8b5..626c6b3fdc 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -711,6 +711,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);