Skip to content

Commit 4eddbc5

Browse files
committed
Fix leak in Zend/tests/bug64720.phpt
Don't rely on the cycle collector for objects released in destructor.
1 parent 969a472 commit 4eddbc5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Zend/zend_objects_API.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ ZEND_API void ZEND_FASTCALL zend_objects_store_call_destructors(zend_objects_sto
5555
|| obj->ce->destructor) {
5656
GC_ADDREF(obj);
5757
obj->handlers->dtor_obj(obj);
58-
GC_DELREF(obj);
58+
if (UNEXPECTED(GC_DELREF(obj) == 0)) {
59+
zend_objects_store_del(obj);
60+
}
5961
}
6062
}
6163
}

0 commit comments

Comments
 (0)