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/date/php_date.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/date/php_date.c')
| -rw-r--r-- | ext/date/php_date.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 5c5dd59218..6898b28ecc 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1230,10 +1230,8 @@ static zend_object_value date_object_new_date(zend_class_entry *class_type TSRML intern = emalloc(sizeof(php_date_obj)); memset(intern, 0, sizeof(php_date_obj)); - intern->std.ce = class_type; - 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); zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC); @@ -1250,10 +1248,8 @@ static zend_object_value date_object_new_timezone(zend_class_entry *class_type T intern = emalloc(sizeof(php_timezone_obj)); memset(intern, 0, sizeof(php_timezone_obj)); - intern->std.ce = class_type; - 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); zend_hash_copy(intern->std.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &tmp, sizeof(zval *)); retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC); @@ -1273,12 +1269,7 @@ static void date_object_free_storage_date(void *object TSRMLS_DC) timelib_time_dtor(intern->time); } - if (intern->std.properties) { - zend_hash_destroy(intern->std.properties); - efree(intern->std.properties); - intern->std.properties = NULL; - } - + zend_object_std_dtor(&intern->std TSRMLS_CC); efree(object); } @@ -1286,12 +1277,7 @@ static void date_object_free_storage_timezone(void *object TSRMLS_DC) { php_timezone_obj *intern = (php_timezone_obj *)object; - if (intern->std.properties) { - zend_hash_destroy(intern->std.properties); - efree(intern->std.properties); - intern->std.properties = NULL; - } - + zend_object_std_dtor(&intern->std TSRMLS_CC); efree(object); } |
