cvs: php-src(PHP_5_1) /ext/spl spl_iterators.c
| From: | Antony Dovgal | Date: | Tue, 20 Dec 2005 12:41:25 +0000 |
| Subject: | cvs: php-src(PHP_5_1) /ext/spl spl_iterators.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-36071@lists.php.net to get a copy of this message | ||
tony2001 Tue Dec 20 12:41:25 2005 EDT
Modified files: (Branch: PHP_5_1)
/php-src/ext/spl spl_iterators.c
Log:
more SPL leak fixes
http://cvs.php.net/viewcvs.cgi/php-src/ext/spl/spl_iterators.c?r1=1.73.2.11&r2=1.73.2.12&diff_format=u
Index: php-src/ext/spl/spl_iterators.c
diff -u php-src/ext/spl/spl_iterators.c:1.73.2.11 php-src/ext/spl/spl_iterators.c:1.73.2.12
--- php-src/ext/spl/spl_iterators.c:1.73.2.11 Mon Dec 19 00:45:28 2005
+++ php-src/ext/spl/spl_iterators.c Tue Dec 20 12:41:24 2005
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_iterators.c,v 1.73.2.11 2005/12/19 00:45:28 helly Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.12 2005/12/20 12:41:24 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -370,6 +370,7 @@
zval *iterator;
zend_class_entry *ce_iterator;
long mode = RIT_LEAVES_ONLY, flags = 0;
+ int inc_refcount = 1;
php_set_error_handling(EH_THROW, spl_ce_InvalidArgumentException TSRMLS_CC);
@@ -377,6 +378,7 @@
if (instanceof_function(Z_OBJCE_P(iterator), zend_ce_aggregate TSRMLS_CC)) {
zval *aggregate = iterator;
zend_call_method_with_0_params(&aggregate, Z_OBJCE_P(aggregate),
&Z_OBJCE_P(aggregate)->iterator_funcs.zf_new_iterator, "getiterator",
&iterator);
+ inc_refcount = 0;
}
} else {
iterator = NULL;
@@ -426,7 +428,9 @@
}
ce_iterator = Z_OBJCE_P(iterator); /* respect inheritance, don't use spl_ce_RecursiveIterator
*/
intern->iterators[0].iterator = ce_iterator->get_iterator(ce_iterator, iterator TSRMLS_CC);
- iterator->refcount++;
+ if (inc_refcount) {
+ iterator->refcount++;
+ }
intern->iterators[0].zobject = iterator;
intern->iterators[0].ce = ce_iterator;
intern->iterators[0].state = RS_START;