diff options
author | Rob Richards <rrichards@php.net> | 2008-01-30 15:28:46 +0000 |
---|---|---|
committer | Rob Richards <rrichards@php.net> | 2008-01-30 15:28:46 +0000 |
commit | 8a64e9de36e2e5e9652c49c0eb29463379db19f2 (patch) | |
tree | 09d9945eb8a25e6c3a5465574744ec430632df5e /ext/libxml | |
parent | 6a2f085f1ebd1ab47e122ce2197d262401a63428 (diff) | |
download | php-git-8a64e9de36e2e5e9652c49c0eb29463379db19f2.tar.gz |
MFH: fix bug #41562 (SimpleXML memory issue)
Diffstat (limited to 'ext/libxml')
-rw-r--r-- | ext/libxml/libxml.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index bdd357fd47..0204d20ff3 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -141,24 +141,6 @@ zend_module_entry libxml_module_entry = { /* }}} */ /* {{{ internal functions for interoperability */ -static int php_libxml_dec_node(php_libxml_node_ptr *nodeptr) -{ - int ret_refcount; - - ret_refcount = --nodeptr->refcount; - if (ret_refcount == 0) { - if (nodeptr->node != NULL && nodeptr->node->type != XML_DOCUMENT_NODE) { - nodeptr->node->_private = NULL; - } - /* node is destroyed by another object. reset ret_refcount to 1 and node to NULL - so the php_libxml_node_ptr is detroyed when the object is destroyed */ - nodeptr->refcount = 1; - nodeptr->node = NULL; - } - - return ret_refcount; -} - static int php_libxml_clear_object(php_libxml_node_object *object TSRMLS_DC) { if (object->properties) { @@ -179,7 +161,10 @@ static int php_libxml_unregister_node(xmlNodePtr nodep TSRMLS_DC) if (wrapper) { php_libxml_clear_object(wrapper TSRMLS_CC); } else { - php_libxml_dec_node(nodeptr); + if (nodeptr->node != NULL && nodeptr->node->type != XML_DOCUMENT_NODE) { + nodeptr->node->_private = NULL; + } + nodeptr->node = NULL; } } |