diff options
author | Antony Dovgal <tony2001@php.net> | 2005-11-15 14:08:03 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2005-11-15 14:08:03 +0000 |
commit | 23a3fdbf048c9bc4e772d1c64352b797187f1d96 (patch) | |
tree | 1afe0b27ac49d53df496036c83a2bfddb36ec2f2 | |
parent | 64931b62cc6bed6c7397dcca826df3395258d07f (diff) | |
download | php-git-23a3fdbf048c9bc4e772d1c64352b797187f1d96.tar.gz |
MFH: call zend_objects_destroy_object() explicitly
fix segfault when intern->time is NULL
-rw-r--r-- | ext/date/php_date.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index dc2765b8b4..f737b4305f 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1024,7 +1024,7 @@ static zend_object_value date_object_new_date(zend_class_entry *class_type TSRML memset(intern, 0, sizeof(php_date_obj)); intern->std.ce = class_type; - retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) date_object_free_storage_date, NULL TSRMLS_CC); + 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); retval.handlers = &date_object_handlers_date; return retval; @@ -1039,7 +1039,7 @@ static zend_object_value date_object_new_timezone(zend_class_entry *class_type T memset(intern, 0, sizeof(php_timezone_obj)); intern->std.ce = class_type; - retval.handle = zend_objects_store_put(intern, NULL, (zend_objects_free_object_storage_t) date_object_free_storage_timezone, NULL TSRMLS_CC); + 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); retval.handlers = &date_object_handlers_timezone; return retval; @@ -1049,10 +1049,12 @@ static void date_object_free_storage_date(void *object TSRMLS_DC) { php_date_obj *intern = (php_date_obj *)object; - if (intern->time->tz_info) { - timelib_tzinfo_dtor(intern->time->tz_info); + if (intern->time) { + if (intern->time->tz_info) { + timelib_tzinfo_dtor(intern->time->tz_info); + } + timelib_time_dtor(intern->time); } - timelib_time_dtor(intern->time); efree(object); } |