cvs: php-src(PHP_4_4) /ext/standard array.c
| From: | Dmitry Stogov | Date: | Wed, 08 Jun 2005 19:55:01 +0000 |
| Subject: | cvs: php-src(PHP_4_4) /ext/standard array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-32170@lists.php.net to get a copy of this message | ||
dmitry Wed Jun 8 15:55:01 2005 EDT
Modified files: (Branch: PHP_4_4)
/php-src/ext/standard array.c
Log:
Fixed memory allocation bugs in array_reduce() with initial value (#22463 & #24980)
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.199.2.44&r2=1.199.2.44.2.1&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.199.2.44 php-src/ext/standard/array.c:1.199.2.44.2.1
--- php-src/ext/standard/array.c:1.199.2.44 Mon Apr 25 02:14:50 2005
+++ php-src/ext/standard/array.c Wed Jun 8 15:55:01 2005
@@ -22,7 +22,7 @@
*/
-/* $Id: array.c,v 1.199.2.44 2005/04/25 06:14:50 dmitry Exp $ */
+/* $Id: array.c,v 1.199.2.44.2.1 2005/06/08 19:55:01 dmitry Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -3238,8 +3238,11 @@
efree(callback_name);
if (ZEND_NUM_ARGS() > 2) {
- convert_to_long_ex(initial);
- result = *initial;
+ ALLOC_ZVAL(result);
+ *result = **initial;
+ zval_copy_ctor(result);
+ convert_to_long(result);
+ INIT_PZVAL(result);
} else {
MAKE_STD_ZVAL(result);
ZVAL_NULL(result);
@@ -3255,6 +3258,7 @@
if (result) {
*return_value = *result;
zval_copy_ctor(return_value);
+ zval_ptr_dtor(&result);
}
return;
}