1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix emory leak

Fixes oss-fuzz #44408
This commit is contained in:
Dmitry Stogov
2022-02-11 15:16:08 +03:00
parent a506b0006e
commit 73fed0f028
2 changed files with 14 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
--TEST--
Closure::bindTo leaks with "fake" closure
--FILE--
<?php
function foo(){
static $y;
}
Closure::fromCallable('foo')->bindTo(new stdClass);
?>
DONE
--EXPECT--
DONE

View File

@@ -770,7 +770,8 @@ static void zend_create_closure_ex(zval *res, zend_function *func, zend_class_en
ZEND_API void zend_create_closure(zval *res, zend_function *func, zend_class_entry *scope, zend_class_entry *called_scope, zval *this_ptr)
{
zend_create_closure_ex(res, func, scope, called_scope, this_ptr, /* is_fake */ false);
zend_create_closure_ex(res, func, scope, called_scope, this_ptr,
/* is_fake */ (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE) != 0);
}
ZEND_API void zend_create_fake_closure(zval *res, zend_function *func, zend_class_entry *scope, zend_class_entry *called_scope, zval *this_ptr) /* {{{ */