cvs: ZendEngine2(PHP_5_3) / zend_constants.c zend_objects_API.c

From: Date: Tue, 19 Feb 2008 12:00:53 +0000
Subject: cvs: ZendEngine2(PHP_5_3) / zend_constants.c zend_objects_API.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6427@lists.php.net to get a copy of this message
dmitry Tue Feb 19 12:00:53 2008 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2 zend_constants.c zend_objects_API.c Log: iFixed memory leak http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_constants.c?r1=1.71.2.5.2.7.2.7&r2=1.71.2.5.2.7.2.8&diff_format=u Index: ZendEngine2/zend_constants.c diff -u ZendEngine2/zend_constants.c:1.71.2.5.2.7.2.7 ZendEngine2/zend_constants.c:1.71.2.5.2.7.2.8 --- ZendEngine2/zend_constants.c:1.71.2.5.2.7.2.7 Mon Dec 31 07:17:04 2007 +++ ZendEngine2/zend_constants.c Tue Feb 19 12:00:53 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_constants.c,v 1.71.2.5.2.7.2.7 2007/12/31 07:17:04 sebastian Exp $ */ +/* $Id: zend_constants.c,v 1.71.2.5.2.7.2.8 2008/02/19 12:00:53 dmitry Exp $ */ #include "zend.h" #include "zend_constants.h" @@ -392,6 +392,7 @@ zval_update_constant_ex(ret_constant, (void*)1, ce TSRMLS_CC); *result = **ret_constant; zval_copy_ctor(result); + INIT_PZVAL(result); } return retval; http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_objects_API.c?r1=1.47.2.6.2.6.2.3&r2=1.47.2.6.2.6.2.4&diff_format=u Index: ZendEngine2/zend_objects_API.c diff -u ZendEngine2/zend_objects_API.c:1.47.2.6.2.6.2.3 ZendEngine2/zend_objects_API.c:1.47.2.6.2.6.2.4 --- ZendEngine2/zend_objects_API.c:1.47.2.6.2.6.2.3 Tue Jan 22 09:27:47 2008 +++ ZendEngine2/zend_objects_API.c Tue Feb 19 12:00:53 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_objects_API.c,v 1.47.2.6.2.6.2.3 2008/01/22 09:27:47 dmitry Exp $ */ +/* $Id: zend_objects_API.c,v 1.47.2.6.2.6.2.4 2008/02/19 12:00:53 dmitry Exp $ */ #include "zend.h" #include "zend_globals.h" @@ -158,8 +158,7 @@ #define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \ EG(objects_store).object_buckets[handle].bucket.free_list.next = EG(objects_store).free_list_head; \ - EG(objects_store).free_list_head = handle; \ - EG(objects_store).object_buckets[handle].valid = 0; + EG(objects_store).free_list_head = handle; ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) { @@ -186,13 +185,12 @@ return; } - obj = &EG(objects_store).object_buckets[handle].bucket.obj; - /* Make sure we hold a reference count during the destructor call otherwise, when the destructor ends the storage might be freed when the refcount reaches 0 a second time */ if (EG(objects_store).object_buckets[handle].valid) { + obj = &EG(objects_store).object_buckets[handle].bucket.obj; if (obj->refcount == 1) { if (!EG(objects_store).object_buckets[handle].destructor_called) { EG(objects_store).object_buckets[handle].destructor_called = 1; @@ -206,6 +204,7 @@ } } if (obj->refcount == 1) { + EG(objects_store).object_buckets[handle].valid = 0; GC_REMOVE_ZOBJ_FROM_BUFFER(obj); if (obj->free_storage) { zend_try { @@ -217,19 +216,20 @@ ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST(); } } - } - obj->refcount--; + obj->refcount--; #if ZEND_DEBUG_OBJECTS - if (obj->refcount == 0) { - fprintf(stderr, "Deallocated object id #%d\n", handle); - } else { - fprintf(stderr, "Decreased refcount of object id #%d\n", handle); - } + if (obj->refcount == 0) { + fprintf(stderr, "Deallocated object id #%d\n", handle); + } else { + fprintf(stderr, "Decreased refcount of object id #%d\n", handle); + } #endif - if (failure) { - zend_bailout(); + + if (failure) { + zend_bailout(); + } } }

« previous php.zend-engine.cvs (#6427) next »