com php-src: Fix Closure leak in aborted INIT_DYNAMIC_FCALL : Zend/tests/closure_call_leak_with_exception.php t Zend/zend_execute.c
| From: | Bob Weinand | Date: | Fri, 26 Jun 2015 03:10:58 +0000 |
| Subject: | com php-src: Fix Closure leak in aborted INIT_DYNAMIC_FCALL : Zend/tests/closure_call_leak_with_exception.php t Zend/zend_execute.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87539@lists.php.net to get a copy of this message | ||
Commit: 1335ebd0681f821ac143fb65daf78807fc619b8b
Author: Bob Weinand <bobwei9@hotmail.com> Fri, 26 Jun 2015 05:10:58 +0200
Parents: bc0df38e887e362761737227dd3c7b9b252e946c
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1335ebd0681f821ac143fb65daf78807fc619b8b
Log:
Fix Closure leak in aborted INIT_DYNAMIC_FCALL
Changed paths:
A Zend/tests/closure_call_leak_with_exception.phpt
M Zend/zend_execute.c
Diff:
diff --git a/Zend/tests/closure_call_leak_with_exception.phpt
b/Zend/tests/closure_call_leak_with_exception.phpt
new file mode 100644
index 0000000..07374c7
--- /dev/null
+++ b/Zend/tests/closure_call_leak_with_exception.phpt
@@ -0,0 +1,14 @@
+--FILE--
+Closure must not leak during a dynmaic call interrupted by an exception
+--TEST--
+<?php
+
+(function() {
+ $closure = function($foo) { var_dump($foo); };
+ $closure(yield);
+})()->valid(); // start
+
+?>
+==DONE==
+--EXPECT--
+==DONE==
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index 8fc4024..e80f429 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -2486,6 +2486,9 @@ static zend_always_inline void
i_cleanup_unfinished_execution(zend_execute_data
}
OBJ_RELEASE(Z_OBJ(call->This));
}
+ if (call->func->common.fn_flags & ZEND_ACC_CLOSURE) {
+ zend_object_release(call->func->common.prototype);
+ }
if (call->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE) {
zend_string_release(call->func->common.function_name);
zend_free_trampoline(call->func);