wez Sun Jul 18 05:55:47 2004 EDT
Modified files:
/php-src/ext/standard basic_functions.c
Log:
don't allocate 0 bytes here either
http://cvs.php.net/diff.php/php-src/ext/standard/basic_functions.c?r1=1.673&r2=1.674&ty=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.673
php-src/ext/standard/basic_functions.c:1.674
--- php-src/ext/standard/basic_functions.c:1.673 Sun Jun 27 17:49:47 2004
+++ php-src/ext/standard/basic_functions.c Sun Jul 18 05:55:46 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.673 2004/06/27 21:49:47 iliaa Exp $ */
+/* $Id: basic_functions.c,v 1.674 2004/07/18 09:55:46 wez Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -1956,13 +1956,17 @@
func_params_ht = Z_ARRVAL_PP(params);
count = zend_hash_num_elements(func_params_ht);
- func_params = safe_emalloc(sizeof(zval **), count, 0);
+ if (count) {
+ func_params = safe_emalloc(sizeof(zval **), count, 0);
- for (zend_hash_internal_pointer_reset(func_params_ht);
- zend_hash_get_current_data(func_params_ht, (void **)
&func_params[current]) == SUCCESS;
- zend_hash_move_forward(func_params_ht)
- ) {
- current++;
+ for (zend_hash_internal_pointer_reset(func_params_ht);
+ zend_hash_get_current_data(func_params_ht, (void **)
&func_params[current]) == SUCCESS;
+ zend_hash_move_forward(func_params_ht)
+ ) {
+ current++;
+ }
+ } else {
+ func_params = NULL;
}
if (call_user_function_ex(EG(function_table), NULL, *func, &retval_ptr, count,
func_params, 0, NULL TSRMLS_CC) == SUCCESS && retval_ptr) {
@@ -1972,7 +1976,9 @@
}
efree(name);
- efree(func_params);
+ if (func_params) {
+ efree(func_params);
+ }
}
/* }}} */
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php