summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2004-07-18 09:55:02 +0000
committerWez Furlong <wez@php.net>2004-07-18 09:55:02 +0000
commitaf9c0b84cdcb5addea929a0ad2cbacd4e275c17c (patch)
tree436ad16faaf30946d7661aa23df587fe20d89136
parent9f50e40643056ff42503ab377eef9a56505cf105 (diff)
downloadphp-git-af9c0b84cdcb5addea929a0ad2cbacd4e275c17c.tar.gz
No point allocating 0 bytes
-rw-r--r--Zend/zend_execute_API.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 0cee71deb1..8c763f28be 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -514,13 +514,18 @@ ZEND_API int zval_update_constant(zval **pp, void *arg TSRMLS_DC)
int call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, zend_uint param_count, zval *params[] TSRMLS_DC)
{
- zval ***params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
+ zval ***params_array;
zend_uint i;
int ex_retval;
zval *local_retval_ptr;
- for (i=0; i<param_count; i++) {
- params_array[i] = &params[i];
+ if (param_count) {
+ params_array = (zval ***) emalloc(sizeof(zval **)*param_count);
+ for (i=0; i<param_count; i++) {
+ params_array[i] = &params[i];
+ }
+ } else {
+ params_array = NULL;
}
ex_retval = call_user_function_ex(function_table, object_pp, function_name, &local_retval_ptr, param_count, params_array, 1, NULL TSRMLS_CC);
if (local_retval_ptr) {
@@ -528,7 +533,9 @@ int call_user_function(HashTable *function_table, zval **object_pp, zval *functi
} else {
INIT_ZVAL(*retval_ptr);
}
- efree(params_array);
+ if (params_array) {
+ efree(params_array);
+ }
return ex_retval;
}