diff options
author | Aart Stuurman <aart.stuurman@copernica.com> | 2015-07-28 11:32:19 +0200 |
---|---|---|
committer | Aart Stuurman <aart.stuurman@copernica.com> | 2015-07-28 11:32:19 +0200 |
commit | 544503eb03ec80c32f347aa9db664e5d2dd8c013 (patch) | |
tree | c6368616c60dad840d3b198a1cc833b3524e4068 /zend | |
parent | 852dce11277755735d10c8ccb84a23f615792655 (diff) |
fixed memory leak when iterating over a Php::Traversable object
Diffstat (limited to 'zend')
-rw-r--r-- | zend/iteratorimpl.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/zend/iteratorimpl.cpp b/zend/iteratorimpl.cpp index 2750ddb..3bd2ed7 100644 --- a/zend/iteratorimpl.cpp +++ b/zend/iteratorimpl.cpp @@ -82,7 +82,10 @@ void IteratorImpl::key(zend_object_iterator *iter, zval *key TSRMLS_DC) // detach the underlying zval zval *val = retval.detach(); - + + // increment number of references of the zval (we keep a copy too) + Z_ADDREF_P(val); + // copy it to the key ZVAL_ZVAL(key, val, 1, 1); } |