Skip to content

Commit 02d022d

Browse files
committed
PHPC-149: Iterator holding on to dead results
1 parent 61a47d4 commit 02d022d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

php_phongo.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,10 @@ void php_phongo_result_free(php_phongo_result_t *result)
12921292
mongoc_cursor_destroy(result->cursor);
12931293
result->cursor = NULL;
12941294
}
1295+
if (result->visitor_data.zchild) {
1296+
zval_ptr_dtor(&result->visitor_data.zchild);
1297+
result->visitor_data.zchild = NULL;
1298+
}
12951299
}
12961300

12971301
/* {{{ Iterator */
@@ -1308,8 +1312,6 @@ static void phongo_cursor_it_invalidate_current(zend_object_iterator *iter TSRML
13081312

13091313
static void phongo_cursor_it_dtor(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
13101314
{
1311-
iter->funcs->invalidate_current(iter TSRMLS_CC);
1312-
13131315
efree(iter);
13141316
} /* }}} */
13151317

0 commit comments

Comments
 (0)