Skip to content

Commit cbf2df4

Browse files
committed
Fixed memory leak
1 parent 062daaf commit cbf2df4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/date/php_date.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1842,6 +1842,7 @@ PHP_FUNCTION(getdate)
18421842
/* define an overloaded iterator structure */
18431843
typedef struct {
18441844
zend_object_iterator intern;
1845+
zval *date_period_zval;
18451846
zval *current;
18461847
php_period_obj *object;
18471848
int current_index;
@@ -1867,6 +1868,8 @@ static void date_period_it_dtor(zend_object_iterator *iter TSRMLS_DC)
18671868

18681869
date_period_it_invalidate_current(iter TSRMLS_CC);
18691870

1871+
zval_ptr_dtor(&iterator->date_period_zval);
1872+
18701873
efree(iterator);
18711874
}
18721875
/* }}} */
@@ -1980,7 +1983,7 @@ zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval
19801983
Z_ADDREF_P(object);
19811984
iterator->intern.data = (void*) dpobj;
19821985
iterator->intern.funcs = &date_period_it_funcs;
1983-
MAKE_STD_ZVAL(iterator->current);
1986+
iterator->date_period_zval = object;
19841987
iterator->object = dpobj;
19851988
iterator->current = NULL;
19861989

0 commit comments

Comments
 (0)