mirror of
https://github.com/php/php-src.git
synced 2026-04-29 11:13:36 +02:00
MFB: more SPL leak fixes
This commit is contained in:
@@ -372,6 +372,7 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
|
||||
zval *iterator;
|
||||
zend_class_entry *ce_iterator;
|
||||
long mode = RIT_LEAVES_ONLY, flags = 0;
|
||||
int inc_refcount = 1;
|
||||
|
||||
php_set_error_handling(EH_THROW, U_CLASS_ENTRY(spl_ce_InvalidArgumentException) TSRMLS_CC);
|
||||
|
||||
@@ -379,6 +380,7 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
|
||||
if (instanceof_function(Z_OBJCE_P(iterator), U_CLASS_ENTRY(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;
|
||||
@@ -428,7 +430,9 @@ SPL_METHOD(RecursiveIteratorIterator, __construct)
|
||||
}
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user