Skip to content

Commit 1a398f9

Browse files
committed
#25: * fix Zend GC issue after refactoring
1 parent 9f57f11 commit 1a398f9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Zend/zend_gc.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2185,7 +2185,7 @@ ZEND_API int zend_gc_collect_cycles(void)
21852185
gc_stack *stack = NULL;
21862186

21872187
if (in_fiber) {
2188-
context = emalloc(sizeof(gc_async_context_t));
2188+
context = ecalloc(1, sizeof(gc_async_context_t));
21892189
stack = emalloc(sizeof(gc_stack));
21902190
} else {
21912191
context = &GC_G(async_context);
@@ -2462,13 +2462,15 @@ ZEND_API int zend_gc_collect_cycles(void)
24622462
GC_G(collector_time) += zend_hrtime() - GC_COLLECT_START_TIME;
24632463
#ifdef PHP_ASYNC_API
24642464
if (in_fiber) {
2465+
const int total_count = GC_COLLECT_TOTAL_COUNT;
24652466
efree(context);
2466-
gc_stack_free(stack);
24672467
efree(stack);
2468+
return total_count;
24682469
} else {
24692470
GC_G(async_context).state = GC_ASYNC_STATE_NONE;
24702471
if (GC_G(gc_stack) != NULL) {
2471-
GC_COLLECT_FREE_STACK;
2472+
GC_G(gc_stack) = NULL;
2473+
efree(stack);
24722474
}
24732475
}
24742476
#endif

0 commit comments

Comments
 (0)