From da022874c573275b99a84150f6042ad0a198a77b Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Thu, 12 Jun 2008 12:40:13 +0000 Subject: [PATCH] MFH --- ext/spl/spl_fastarray.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/spl/spl_fastarray.c b/ext/spl/spl_fastarray.c index 0c0f725527..f9cd75ea69 100644 --- a/ext/spl/spl_fastarray.c +++ b/ext/spl/spl_fastarray.c @@ -75,6 +75,7 @@ typedef struct _spl_fastarray_it { /* {{{ */ static void spl_fastarray_init(spl_fastarray *array, long size TSRMLS_DC) /* {{{ */ { if (size > 0) { + array->size = 0; /* reset size in case ecalloc() fails */ array->elements = ecalloc(size, sizeof(zval *)); array->size = size; } else { @@ -198,7 +199,7 @@ static void spl_fastarray_object_free_storage(void *object TSRMLS_DC) /* {{{ */ } } - if (intern->array->elements) { + if (intern->array->size > 0 && intern->array->elements) { efree(intern->array->elements); } efree(intern->array); -- 2.50.1