iliaa Sat Sep 22 15:38:00 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard array.c Log: Fixed memory leak inside array_intersec (coverity issues #403,#404) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.36&r2=1.308.2.21.2.37&diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.308.2.21.2.36 php-src/ext/standard/array.c:1.308.2.21.2.37 --- php-src/ext/standard/array.c:1.308.2.21.2.36 Sat Sep 22 15:32:11 2007 +++ php-src/ext/standard/array.c Sat Sep 22 15:38:00 2007 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.308.2.21.2.36 2007/09/22 15:32:11 iliaa Exp $ */ +/* $Id: array.c,v 1.308.2.21.2.37 2007/09/22 15:38:00 iliaa Exp $ */ #include "php.h" #include "php_ini.h" @@ -3156,10 +3156,12 @@ intersect_data_compare_func = array_user_compare; BG(user_compare_func_name) = args[arr_argc + 1];/* data - key */ } else { + efree(args); php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug.", data_compare_type, key_compare_type); return; } } else { + efree(args); php_error_docref(NULL TSRMLS_CC, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior); return; } @@ -3178,6 +3180,9 @@ hash = HASH_OF(*args[i]); list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent); if (!list) { + efree(args); + efree(lists); + efree(ptrs); RETURN_FALSE; } lists[i] = list; @@ -3612,10 +3617,12 @@ diff_data_compare_func = array_user_compare; BG(user_compare_func_name) = args[arr_argc + 1];/* data - key*/ } else { + efree(args); php_error_docref(NULL TSRMLS_CC, E_WARNING, "data_compare_type is %d. key_compare_type is %d. This should never happen. Please report as a bug", data_compare_type, key_compare_type); return; } } else { + efree(args); php_error_docref(NULL TSRMLS_CC, E_WARNING, "behavior is %d. This should never happen. Please report as a bug", behavior); return; } @@ -3634,6 +3641,7 @@ hash = HASH_OF(*args[i]); list = (Bucket **) pemalloc((hash->nNumOfElements + 1) * sizeof(Bucket *), hash->persistent); if (!list) { + efree(args); efree(ptrs); efree(lists); RETURN_FALSE;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php