cvs: php4 /ext/standard array.c

From: Date: Tue, 07 Aug 2001 16:41:33 +0000
Subject: cvs: php4 /ext/standard array.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6625@lists.php.net to get a copy of this message
andrei Tue Aug 7 12:41:33 2001 EDT Modified files: /php4/ext/standard array.c Log: Fix a couple of leaks. Index: php4/ext/standard/array.c diff -u php4/ext/standard/array.c:1.121 php4/ext/standard/array.c:1.122 --- php4/ext/standard/array.c:1.121 Sun Aug 5 23:50:50 2001 +++ php4/ext/standard/array.c Tue Aug 7 12:41:33 2001 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.121 2001/08/06 03:50:50 sas Exp $ */ +/* $Id: array.c,v 1.122 2001/08/07 16:41:33 andrei Exp $ */ #include "php.h" #include "php_ini.h" @@ -2876,8 +2876,10 @@ } efree(callback_name); - if (ZEND_NUM_ARGS() > 2) + if (ZEND_NUM_ARGS() > 2) { result = *initial; + zval_add_ref(&result); + } if (zend_hash_num_elements(Z_ARRVAL_PP(input)) == 0) { if (result) { @@ -2893,18 +2895,23 @@ args[0] = &result; args[1] = operand; if (call_user_function_ex(EG(function_table), NULL, *callback, &retval, 2, args, 0, NULL TSRMLS_CC) == SUCCESS && retval) { + zval_ptr_dtor(&result); result = retval; } else { php_error(E_WARNING, "%s() had an error invoking the reduction callback", get_active_function_name(TSRMLS_C)); return; } - } else + } else { result = *operand; + zval_add_ref(&result); + } zend_hash_move_forward_ex(Z_ARRVAL_PP(input), &pos); } *return_value = *result; + zval_copy_ctor(return_value); + zval_ptr_dtor(&result); } /* }}} */

« previous php.cvs (#6625) next »