diff options
author | Antony Dovgal <tony2001@php.net> | 2006-08-06 17:41:51 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-08-06 17:41:51 +0000 |
commit | 07b5c8fe2a5f3a3714641c543a9d9e12799ac1bb (patch) | |
tree | af18d79eade0ad8c4095dd6bc859620b4ed918c8 /ext/libxml/libxml.c | |
parent | 861c55b41781cc2fd044c1709cba3a9218add754 (diff) | |
download | php-git-07b5c8fe2a5f3a3714641c543a9d9e12799ac1bb.tar.gz |
MFH: fix #38347 (Segmentation fault when using foreach with an unknown/empty SimpleXMLElement)
Diffstat (limited to 'ext/libxml/libxml.c')
-rw-r--r-- | ext/libxml/libxml.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index 7326d57a3c..80b6697236 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -966,8 +966,8 @@ int php_libxml_decrement_doc_ref(php_libxml_node_object *object TSRMLS_DC) { efree(object->document->doc_props); } efree(object->document); + object->document = NULL; } - object->document = NULL; } return ret_refcount; @@ -1025,6 +1025,8 @@ void php_libxml_node_decrement_resource(php_libxml_node_object *object TSRMLS_DC obj_node->_private = NULL; } } + } + if (object != NULL && object->document != NULL) { /* Safe to call as if the resource were freed then doc pointer is NULL */ php_libxml_decrement_doc_ref(object TSRMLS_CC); } |