diff options
author | Toon Schoenmakers <toon.schoenmakers@copernica.com> | 2014-11-21 16:37:08 +0100 |
---|---|---|
committer | Toon Schoenmakers <toon.schoenmakers@copernica.com> | 2014-11-21 16:37:08 +0100 |
commit | 945748c19b966fff297d9a7a1e2dfda3b0a80754 (patch) | |
tree | e1ec0249d0df7aee2f22b11e484a948fae2b0092 /zend/callable.cpp | |
parent | 578fc01d0e6ba0be7818ad2d2533aa3a2dde3ba4 (diff) |
Value::refcount() is now const, and fixed a memory leak in return values
Diffstat (limited to 'zend/callable.cpp')
-rw-r--r-- | zend/callable.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/zend/callable.cpp b/zend/callable.cpp index a85ab72..7505bbf 100644 --- a/zend/callable.cpp +++ b/zend/callable.cpp @@ -52,13 +52,13 @@ void Callable::invoke(INTERNAL_FUNCTION_PARAMETERS) // get the result Value result(callable->invoke(params)); - // detach the zval (we don't want it to be destructed) - zval *val = result.detach(); + // we're ready if the return value is not even used + if (!return_value_used) return; // @todo php 5.6 has a RETVAL_ZVAL_FAST macro that can be used instead (and is faster) // return a full copy of the zval, and do not destruct it - RETVAL_ZVAL(val, 1, 0); + RETVAL_ZVAL(result._val, 1, 0); } catch (Exception &exception) { |