tony2001                Fri Sep 21 13:50:47 2007 UTC

  Added files:                 
    /php-src/ext/standard/tests/array   array_map_001.phpt 

  Modified files:              
    /php-src/ext/standard       array.c 
  Log:
  plug leak on error (coverity issue #405)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.418&r2=1.419&diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.418 php-src/ext/standard/array.c:1.419
--- php-src/ext/standard/array.c:1.418  Fri Sep 21 13:11:16 2007
+++ php-src/ext/standard/array.c        Fri Sep 21 13:50:47 2007
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.418 2007/09/21 13:11:16 dmitry Exp $ */
+/* $Id: array.c,v 1.419 2007/09/21 13:50:47 tony2001 Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -4477,6 +4477,8 @@
                                efree(args);
                                efree(array_pos);
                                zval_dtor(return_value);
+                               zval_ptr_dtor(&null);
+                               efree(params);
                                RETURN_NULL();
                        }
                }

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/array/array_map_001.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/array/array_map_001.phpt
+++ php-src/ext/standard/tests/array/array_map_001.phpt
--TEST--
array_map() and exceptions in the callback
--FILE--
<?php

$a = array(1,2,3);

function foo() { 
        throw new exception(1); 
} 

try { 
        array_map("foo", $a, array(2,3)); 
} catch (Exception $e) {
        var_dump("exception caught!");
}

echo "Done\n";
?>
--EXPECTF--     
Warning: array_map(): An error occurred while invoking the map callback in %s 
on line %d
string(17) "exception caught!"
Done
--UEXPECTF--
Warning: array_map(): An error occurred while invoking the map callback in %s 
on line %d
unicode(17) "exception caught!"
Done

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to