tony2001 Tue Nov 15 09:08:03 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/date php_date.c
Log:
MFH: 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.43.2.19&r2=1.43.2.20&ty=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.19
php-src/ext/date/php_date.c:1.43.2.20
--- php-src/ext/date/php_date.c:1.43.2.19 Wed Oct 19 07:18:51 2005
+++ php-src/ext/date/php_date.c Tue Nov 15 09:08:03 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.c,v 1.43.2.19 2005/10/19 11:18:51 sniper Exp $ */
+/* $Id: php_date.c,v 1.43.2.20 2005/11/15 14:08:03 tony2001 Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1024,7 +1024,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;
@@ -1039,7 +1039,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;
@@ -1049,10 +1049,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