|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-25 23:38 UTC] helly@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ CachingIterator::rewind() leaks some memory. I can propose this small patch, but I'm almost sure it's not the real solution. Index: spl_iterators.c =================================================================== RCS file: /repository/php-src/ext/spl/spl_iterators.c,v retrieving revision 1.61 diff -u -r1.61 spl_iterators.c --- spl_iterators.c 29 Dec 2004 16:11:42 -0000 1.61 +++ spl_iterators.c 30 Dec 2004 09:43:14 -0000 @@ -752,7 +752,8 @@ } if (intern->dit_type == DIT_CachingIterator || intern->dit_type == DIT_CachingRecursiveIterator) { if (intern->u.caching.zstr) { - zval_ptr_dtor(&intern->u.caching.zstr); + zval_dtor(intern->u.caching.zstr); + FREE_ZVAL(intern->u.caching.zstr); intern->u.caching.zstr = NULL; } if (intern->u.caching.zchildren) { Reproduce code: --------------- <?php $a = Array("some","blah"); $i = new ArrayIterator($a); $ci = new CachingIterator($i); $ci->rewind(); echo "Done\n"; ?> Expected result: ---------------- Done Actual result: -------------- Done /home/dev/php-src/ext/spl/spl_iterators.c(1276) : Freeing 0x082E9064 (16 bytes), script=/www/index.php /home/dev/php-src/Zend/zend_variables.h(45) : Freeing 0x082E8E9C (5 bytes), script=/www/index.php /home/dev/php-src/Zend/zend_variables.c(120) : Actual location (location was relayed) === Total 2 memory leaks detected ===