From f63393aee8f3c3a8a3191064f28a4375107b30aa Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 20 Feb 2018 08:23:25 +0100 Subject: [PATCH] Fix possible memory leak --- ext/date/php_date.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index bf2997d946..3d0b885f40 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -2004,13 +2004,15 @@ static const zend_object_iterator_funcs date_period_it_funcs = { zend_object_iterator *date_object_period_get_iterator(zend_class_entry *ce, zval *object, int by_ref) /* {{{ */ { - date_period_it *iterator = emalloc(sizeof(date_period_it)); + date_period_it *iterator; if (by_ref) { zend_throw_error(NULL, "An iterator cannot be used with foreach by reference"); return NULL; } + iterator = emalloc(sizeof(date_period_it)); + zend_iterator_init((zend_object_iterator*)iterator); ZVAL_COPY(&iterator->intern.data, object); -- 2.40.0