summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2005-11-15 14:07:43 +0000
committerAntony Dovgal <tony2001@php.net>2005-11-15 14:07:43 +0000
commit21aeacfa9d697105587f691be2d17ce892879f57 (patch)
tree3852118b788ad4fc8b9f29d5cc8268edf96f3274
parent29c580f138c3f6b9edf64ae38895327874bd3454 (diff)
downloadphp-git-21aeacfa9d697105587f691be2d17ce892879f57.tar.gz
call zend_objects_destroy_object() explicitly
fix segfault when intern->time is NULL
-rw-r--r--ext/date/php_date.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 5ed733ce1b..f904f4d3ac 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -1138,7 +1138,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;
@@ -1153,7 +1153,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;
@@ -1163,10 +1163,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);
}