diff options
author | Antony Dovgal <tony2001@php.net> | 2006-03-29 14:28:43 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2006-03-29 14:28:43 +0000 |
commit | 59b8592c8cb51599147f990ad8b61d8d02cfce05 (patch) | |
tree | 9bf669097b48484400efe53cb52ff567c51ff8e7 /ext/xmlwriter/php_xmlwriter.c | |
parent | 697c652001257e04a5af0f047017fe20f62ee969 (diff) | |
download | php-git-59b8592c8cb51599147f990ad8b61d8d02cfce05.tar.gz |
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)
to initialize and destroy zend_object structs
Diffstat (limited to 'ext/xmlwriter/php_xmlwriter.c')
-rw-r--r-- | ext/xmlwriter/php_xmlwriter.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index 5c66086eb5..05fc571feb 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -77,11 +77,8 @@ static void xmlwriter_object_free_storage(void *object TSRMLS_DC) xmlwriter_free_resource_ptr(intern->xmlwriter_ptr TSRMLS_CC); } intern->xmlwriter_ptr = NULL; - if (intern->zo.properties) { - zend_hash_destroy(intern->zo.properties); - FREE_HASHTABLE(intern->zo.properties); - } - + zend_object_std_dtor(&intern->zo TSRMLS_CC); + efree(intern); } /* }}} */ @@ -96,11 +93,9 @@ PHP_XMLWRITER_API zend_object_value xmlwriter_object_new(zend_class_entry *class intern = emalloc(sizeof(ze_xmlwriter_object)); memset(&intern->zo, 0, sizeof(zend_object)); - intern->zo.ce = class_type; intern->xmlwriter_ptr = NULL; - ALLOC_HASHTABLE(intern->zo.properties); - zend_hash_init(intern->zo.properties, 0, NULL, ZVAL_PTR_DTOR, 0); + zend_object_std_init(&intern->zo, class_type TSRMLS_CC); zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); |