summaryrefslogtreecommitdiff
path: root/ext/dom/php_dom.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-03-29 15:08:52 +0000
committerAntony Dovgal <tony2001@php.net>2006-03-29 15:08:52 +0000
commit6a53a49c8b343d63b586ed2ffcd547767f9746c3 (patch)
tree1afe528ffdb39d7accd54bf9ec81c46b914180f2 /ext/dom/php_dom.c
parent39392cce19b718b272e8e758f64d9124530fde49 (diff)
downloadphp-git-6a53a49c8b343d63b586ed2ffcd547767f9746c3.tar.gz
MF51: fix bug #36898 (__set() leaks in classes extending internal ones)
Added: ZEND_API void zend_object_std_init(zend_object *object, zend_class_entry *ce TSRMLS_DC) ZEND_API void zend_object_std_dtor(zend_object *object TSRMLS_DC)
Diffstat (limited to 'ext/dom/php_dom.c')
-rw-r--r--ext/dom/php_dom.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c
index 0273f80b1b..f06f7badb8 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -934,8 +934,7 @@ void dom_xpath_objects_free_storage(void *object TSRMLS_DC)
{
dom_object *intern = (dom_object *)object;
- zend_hash_destroy(intern->std.properties);
- FREE_HASHTABLE(intern->std.properties);
+ zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->ptr != NULL) {
xmlXPathFreeContext((xmlXPathContextPtr) intern->ptr);
@@ -954,8 +953,7 @@ void dom_objects_free_storage(void *object TSRMLS_DC)
dom_object *intern = (dom_object *)object;
int retcount;
- zend_hash_destroy(intern->std.properties);
- FREE_HASHTABLE(intern->std.properties);
+ zend_object_std_dtor(&intern->std TSRMLS_CC);
if (intern->ptr != NULL && ((php_libxml_node_ptr *)intern->ptr)->node != NULL) {
if (((xmlNodePtr) ((php_libxml_node_ptr *)intern->ptr)->node)->type != XML_DOCUMENT_NODE && ((xmlNodePtr) ((php_libxml_node_ptr *)intern->ptr)->node)->type != XML_HTML_DOCUMENT_NODE) {
@@ -1001,8 +999,6 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
dom_object *intern;
intern = emalloc(sizeof(dom_object));
- intern->std.ce = class_type;
- intern->std.guards = NULL;
intern->ptr = NULL;
intern->prop_handler = NULL;
intern->document = NULL;
@@ -1014,8 +1010,7 @@ static dom_object* dom_objects_set_class(zend_class_entry *class_type, zend_bool
zend_u_hash_find(UG(unicode)?&u_classes:&classes, UG(unicode)?IS_UNICODE:IS_STRING, base_class->name, base_class->name_length + 1, (void **) &intern->prop_handler);
- ALLOC_HASHTABLE(intern->std.properties);
- zend_hash_init(intern->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
+ zend_object_std_init(&intern->std, class_type TSRMLS_CC);
if (hash_copy) {
zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *));
}
@@ -1120,8 +1115,7 @@ void dom_nnodemap_objects_free_storage(void *object TSRMLS_DC)
php_libxml_decrement_doc_ref((php_libxml_node_object *)intern TSRMLS_CC);
- zend_hash_destroy(intern->std.properties);
- FREE_HASHTABLE(intern->std.properties);
+ zend_object_std_dtor(&intern->std TSRMLS_CC);
efree(object);
}