cvs: php-src(PHP_5_3) /ext/spl spl_fastarray.c
| From: | Antony Dovgal | Date: | Thu, 12 Jun 2008 12:40:13 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/spl spl_fastarray.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-50394@lists.php.net to get a copy of this message | ||
tony2001 Thu Jun 12 12:40:13 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/spl spl_fastarray.c
Log:
MFH
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_fastarray.c?r1=1.1.2.7&r2=1.1.2.8&diff_format=u
Index: php-src/ext/spl/spl_fastarray.c
diff -u php-src/ext/spl/spl_fastarray.c:1.1.2.7 php-src/ext/spl/spl_fastarray.c:1.1.2.8
--- php-src/ext/spl/spl_fastarray.c:1.1.2.7 Mon Jun 9 17:29:23 2008
+++ php-src/ext/spl/spl_fastarray.c Thu Jun 12 12:40:13 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_fastarray.c,v 1.1.2.7 2008/06/09 17:29:23 colder Exp $ */
+/* $Id: spl_fastarray.c,v 1.1.2.8 2008/06/12 12:40:13 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -75,6 +75,7 @@
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 @@
}
}
- if (intern->array->elements) {
+ if (intern->array->size > 0 && intern->array->elements) {
efree(intern->array->elements);
}
efree(intern->array);