Skip to content

Commit c322a0f

Browse files
committed
We need to release the trampoline before the closure (but haven't figured out why...)
1 parent 2183727 commit c322a0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Zend/zend_API.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,15 +743,13 @@ static zend_always_inline bool zend_fcc_equals(const zend_fcall_info_cache* a, c
743743
static zend_always_inline void zend_fcc_addref(zend_fcall_info_cache *fcc)
744744
{
745745
ZEND_ASSERT(ZEND_FCC_INITIALIZED(*fcc) && "FCC Not initialized, possibly refetch trampoline freed by ZPP?");
746-
/*
747746
if (UNEXPECTED(fcc->function_handler == &EG(trampoline))) {
748747
zend_function *copy = emalloc(sizeof(zend_function));
749748

750749
memcpy(copy, fcc->function_handler, sizeof(zend_function));
751750
fcc->function_handler->common.function_name = NULL;
752751
fcc->function_handler = copy;
753752
}
754-
*/
755753
if (fcc->object) {
756754
GC_ADDREF(fcc->object);
757755
}
@@ -768,13 +766,15 @@ static zend_always_inline void zend_fcc_dup(/* restrict */ zend_fcall_info_cache
768766

769767
static zend_always_inline void zend_fcc_dtor(zend_fcall_info_cache *fcc)
770768
{
769+
ZEND_ASSERT(fcc->function_handler);
771770
if (fcc->object) {
772771
OBJ_RELEASE(fcc->object);
773772
}
773+
/* Will free trampoline if it is set */
774+
zend_release_fcall_info_cache(fcc);
774775
if (fcc->closure) {
775776
OBJ_RELEASE(fcc->closure);
776777
}
777-
zend_release_fcall_info_cache(fcc);
778778
memcpy(fcc, &empty_fcall_info_cache, sizeof(zend_fcall_info_cache));
779779
}
780780

0 commit comments

Comments
 (0)