Fixed small leaks in array_map() in case the first parameter is NULL like

array_map(NULL, array(...));
This commit is contained in:
Moriyoshi Koizumi 2003-01-03 05:05:12 +00:00
parent 449029d2df
commit f962ba6abb

View File

@ -3418,6 +3418,8 @@ PHP_FUNCTION(array_map)
WRONG_PARAM_COUNT;
}
RETVAL_NULL();
callback = *args[0];
if (Z_TYPE_P(callback) != IS_NULL) {
if (!zend_is_callable(callback, 0, &callback_name)) {
@ -3438,6 +3440,7 @@ PHP_FUNCTION(array_map)
if (Z_TYPE_PP(args[i+1]) != IS_ARRAY) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument #%d should be an array", i + 2);
efree(array_len);
efree(array_pos);
efree(args);
return;
}