diff options
author | Aart Stuurman <aart.stuurman@copernica.com> | 2015-07-28 11:37:11 +0200 |
---|---|---|
committer | Aart Stuurman <aart.stuurman@copernica.com> | 2015-07-28 11:37:11 +0200 |
commit | 02bd933b1e15de1d28860b4c01d0cd3a8447607f (patch) | |
tree | bc6aaa01e593633252390b7444aac493ef1f7103 | |
parent | 544503eb03ec80c32f347aa9db664e5d2dd8c013 (diff) |
fixed memory leak when using magic casting functions like __toInteger
-rw-r--r-- | zend/classimpl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/zend/classimpl.cpp b/zend/classimpl.cpp index 4a9b0b7..71b85e5 100644 --- a/zend/classimpl.cpp +++ b/zend/classimpl.cpp @@ -476,6 +476,9 @@ int ClassImpl::cast(zval *val, zval *retval, int type TSRMLS_DC) // @todo do we turn into endless conversion if the __toString object returns 'this' ?? // (and if it does: who cares? If the extension programmer is stupid, why do we have to suffer?) + + // increment refcount for "result" (we keep a reference here) + Z_ADDREF_P(result); // is the original parameter overwritten? if (val == retval) zval_dtor(val); |