Skip to content

Commit 14af1fe

Browse files
committed
Fixed reference counting
1 parent 523396c commit 14af1fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/spl/spl_directory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,8 +1644,8 @@ zend_object_iterator *spl_filesystem_dir_get_iterator(zend_class_entry *ce, zval
16441644
/* ->current must be initialized; rewind doesn't set it and valid
16451645
* doesn't check whether it's set */
16461646
iterator->current = object;
1647+
Z_SET_REFCOUNT_P(object, Z_REFCOUNT_P(object) + 2);
16471648
}
1648-
zval_add_ref(&object);
16491649

16501650
return (zend_object_iterator*)iterator;
16511651
}
@@ -1847,8 +1847,8 @@ zend_object_iterator *spl_filesystem_tree_get_iterator(zend_class_entry *ce, zva
18471847
if (iterator->intern.data == NULL) {
18481848
iterator->intern.data = object;
18491849
iterator->intern.funcs = &spl_filesystem_tree_it_funcs;
1850+
zval_add_ref(&object);
18501851
}
1851-
zval_add_ref(&object);
18521852

18531853
return (zend_object_iterator*)iterator;
18541854
}

0 commit comments

Comments
 (0)