summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2010-09-03 09:27:47 +0000
committerDmitry Stogov <dmitry@php.net>2010-09-03 09:27:47 +0000
commit88bf6d2e1622645855392dac56f8df080dc48af3 (patch)
tree757b4635527c1bc53f1a0ab973992df17937eabb
parentd1f40f74391e2680d12f558bf87d9adae2e82021 (diff)
downloadphp-git-88bf6d2e1622645855392dac56f8df080dc48af3.tar.gz
Fixed GC bug
-rw-r--r--Zend/zend_gc.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c
index db04652f09..3237768cbc 100644
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@ -414,19 +414,21 @@ static void gc_mark_roots(TSRMLS_D)
gc_root_buffer *current = GC_G(roots).next;
while (current != &GC_G(roots)) {
- if (current->handle && EG(objects_store).object_buckets) {
- struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj;
+ if (current->handle) {
+ if (EG(objects_store).object_buckets) {
+ struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj;
- if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) {
- zval z;
+ if (GC_GET_COLOR(obj->buffered) == GC_PURPLE) {
+ zval z;
- INIT_PZVAL(&z);
- Z_OBJ_HANDLE(z) = current->handle;
- Z_OBJ_HT(z) = current->u.handlers;
- zobj_mark_grey(obj, &z TSRMLS_CC);
- } else {
- GC_SET_ADDRESS(obj->buffered, NULL);
- GC_REMOVE_FROM_BUFFER(current);
+ INIT_PZVAL(&z);
+ Z_OBJ_HANDLE(z) = current->handle;
+ Z_OBJ_HT(z) = current->u.handlers;
+ zobj_mark_grey(obj, &z TSRMLS_CC);
+ } else {
+ GC_SET_ADDRESS(obj->buffered, NULL);
+ GC_REMOVE_FROM_BUFFER(current);
+ }
}
} else {
if (GC_ZVAL_GET_COLOR(current->u.pz) == GC_PURPLE) {
@@ -623,15 +625,17 @@ static void gc_collect_roots(TSRMLS_D)
gc_root_buffer *current = GC_G(roots).next;
while (current != &GC_G(roots)) {
- if (current->handle && EG(objects_store).object_buckets) {
- struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj;
- zval z;
+ if (current->handle) {
+ if (EG(objects_store).object_buckets) {
+ struct _store_object *obj = &EG(objects_store).object_buckets[current->handle].bucket.obj;
+ zval z;
- GC_SET_ADDRESS(obj->buffered, NULL);
- INIT_PZVAL(&z);
- Z_OBJ_HANDLE(z) = current->handle;
- Z_OBJ_HT(z) = current->u.handlers;
- zobj_collect_white(&z TSRMLS_CC);
+ GC_SET_ADDRESS(obj->buffered, NULL);
+ INIT_PZVAL(&z);
+ Z_OBJ_HANDLE(z) = current->handle;
+ Z_OBJ_HT(z) = current->u.handlers;
+ zobj_collect_white(&z TSRMLS_CC);
+ }
} else {
GC_ZVAL_SET_ADDRESS(current->u.pz, NULL);
zval_collect_white(current->u.pz TSRMLS_CC);