tony2001 Tue Nov 15 09:07:44 2005 EDT
Modified files:
/php-src/ext/date php_date.c
Log:
call zend_objects_destroy_object() explicitly
fix segfault when intern->time is NULL
http://cvs.php.net/diff.php/php-src/ext/date/php_date.c?r1=1.65&r2=1.66&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.65 php-src/ext/date/php_date.c:1.66
--- php-src/ext/date/php_date.c:1.65 Wed Oct 19 07:18:13 2005
+++ php-src/ext/date/php_date.c Tue Nov 15 09:07:43 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.c,v 1.65 2005/10/19 11:18:13 sniper Exp $ */
+/* $Id: php_date.c,v 1.66 2005/11/15 14:07:43 tony2001 Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1138,7 +1138,7 @@
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 @@
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 @@
{
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);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php