summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/dom/dom_iterators.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c
index 9a6425ad16..aaf00d67c0 100644
--- a/ext/dom/dom_iterators.c
+++ b/ext/dom/dom_iterators.c
@@ -262,12 +262,13 @@ zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, i
int ret, curindex = 0;
HashTable *nodeht;
zval **entry;
+ php_dom_iterator *iterator;
if (by_ref) {
zend_error(E_ERROR, "An iterator cannot be used with foreach by reference");
}
- php_dom_iterator *iterator = emalloc(sizeof(php_dom_iterator));
-
+ iterator = emalloc(sizeof(php_dom_iterator));
+
object->refcount++;
iterator->intern.data = (void*)object;
iterator->intern.funcs = &php_dom_iterator_funcs;