dmitry Thu Feb 14 08:46:08 2008 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard array.c /php-src/ext/standard/tests/array array_push_variation4.phpt Log: Fixed memory leak http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.50&r2=1.308.2.21.2.51&diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.308.2.21.2.50 php-src/ext/standard/array.c:1.308.2.21.2.51 --- php-src/ext/standard/array.c:1.308.2.21.2.50 Tue Feb 12 12:47:30 2008 +++ php-src/ext/standard/array.c Thu Feb 14 08:46:08 2008 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.308.2.21.2.50 2008/02/12 12:47:30 felipe Exp $ */ +/* $Id: array.c,v 1.308.2.21.2.51 2008/02/14 08:46:08 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -1975,6 +1975,7 @@ new_var->refcount++; if (zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL) == FAILURE) { + new_var->refcount--; php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element to the array as the next element is already occupied"); efree(args); RETURN_FALSE; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_push_variation4.phpt?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/standard/tests/array/array_push_variation4.phpt diff -u php-src/ext/standard/tests/array/array_push_variation4.phpt:1.1.2.1 php-src/ext/standard/tests/array/array_push_variation4.phpt:1.1.2.2 --- php-src/ext/standard/tests/array/array_push_variation4.phpt:1.1.2.1 Wed Feb 13 16:10:42 2008 +++ php-src/ext/standard/tests/array/array_push_variation4.phpt Thu Feb 14 08:46:08 2008 @@ -32,6 +32,9 @@ var_dump(array_push($array, &$array)); var_dump($array); +/* break cycle */ +$array[9] = null; + echo "Done"; ?> --EXPECTF--
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php