From c05dfd5605d1ef46aa8e775253d3a4ce32c43feb Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Mon, 9 Feb 2009 08:55:35 +0000 Subject: [PATCH] Better fix for #47341 --- Zend/zend_gc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c index 5475edb3d4..4f6616c920 100644 --- a/Zend/zend_gc.c +++ b/Zend/zend_gc.c @@ -51,8 +51,8 @@ static void gc_globals_ctor_ex(zend_gc_globals *gc_globals TSRMLS_DC) gc_globals->buf = NULL; - gc_globals->roots.next = NULL; - gc_globals->roots.prev = NULL; + gc_globals->roots.next = &gc_globals->roots; + gc_globals->roots.prev = &gc_globals->roots; gc_globals->unused = NULL; gc_globals->zval_to_free = NULL; gc_globals->free_list = NULL; @@ -109,10 +109,10 @@ ZEND_API void gc_reset(TSRMLS_D) GC_G(zobj_marked_grey) = 0; #endif - if (GC_G(buf)) { - GC_G(roots).next = &GC_G(roots); - GC_G(roots).prev = &GC_G(roots); + GC_G(roots).next = &GC_G(roots); + GC_G(roots).prev = &GC_G(roots); + if (GC_G(buf)) { GC_G(unused) = NULL; GC_G(first_unused) = GC_G(buf); @@ -527,7 +527,7 @@ ZEND_API int gc_collect_cycles(TSRMLS_D) { int count = 0; - if (GC_G(roots).next != &GC_G(roots) && GC_G(roots).next) { + if (GC_G(roots).next != &GC_G(roots)) { zval_gc_info *p, *q, *orig_free_list, *orig_next_to_free; if (GC_G(gc_active)) { -- 2.40.0