From 8450fae834dcdecda6875a2607e09425badadaac Mon Sep 17 00:00:00 2001 From: Rob Richards Date: Sun, 2 Jan 2005 12:08:41 +0000 Subject: [PATCH] Fixed bug #31361 (simplexml/domxml segfault when adding node twice) --- ext/libxml/libxml.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 6fd7506414..16cc1aa40a 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -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); -- 2.50.1