summaryrefslogtreecommitdiff
path: root/ext/libxml/libxml.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-08-06 17:41:51 +0000
committerAntony Dovgal <tony2001@php.net>2006-08-06 17:41:51 +0000
commit07b5c8fe2a5f3a3714641c543a9d9e12799ac1bb (patch)
treeaf18d79eade0ad8c4095dd6bc859620b4ed918c8 /ext/libxml/libxml.c
parent861c55b41781cc2fd044c1709cba3a9218add754 (diff)
downloadphp-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.c4
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);
}