nlopess Sat Jan 6 20:16:26 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/zip php_zip.c Log: fix a few memleaks and double-free()s on error conditions http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.1.2.24&r2=1.1.2.25&diff_format=u Index: php-src/ext/zip/php_zip.c diff -u php-src/ext/zip/php_zip.c:1.1.2.24 php-src/ext/zip/php_zip.c:1.1.2.25 --- php-src/ext/zip/php_zip.c:1.1.2.24 Mon Jan 1 09:36:10 2007 +++ php-src/ext/zip/php_zip.c Sat Jan 6 20:16:25 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_zip.c,v 1.1.2.24 2007/01/01 09:36:10 sebastian Exp $ */ +/* $Id: php_zip.c,v 1.1.2.25 2007/01/06 20:16:25 nlopess Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -551,7 +551,9 @@ if (zip_int) { if (zip_int->za) { - zip_close(zip_int->za); + if (zip_close(zip_int->za) != 0) { + _zip_free(zip_int->za); + } zip_int->za = NULL; } @@ -906,16 +908,20 @@ if (ze_obj->za) { /* we already have an opened zip, free it */ - zip_close(ze_obj->za); + if (zip_close(ze_obj->za) != 0) { + _zip_free(ze_obj->za); + } + ze_obj->za = NULL; } if (ze_obj->filename) { efree(ze_obj->filename); + ze_obj->filename = NULL; } intern = zip_open(resolved_path, flags, &err); if (!intern || err) { RETURN_LONG((long)err); } - ze_obj->filename = estrndup(resolved_path, strlen(resolved_path)); + ze_obj->filename = estrdup(resolved_path); ze_obj->filename_len = filename_len; ze_obj->za = intern; RETURN_TRUE; @@ -2000,7 +2006,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "Zip", "enabled"); - php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.24 2007/01/01 09:36:10 sebastian Exp $"); + php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.1.2.25 2007/01/06 20:16:25 nlopess Exp $"); php_info_print_table_row(2, "Zip version", "2.0.0"); php_info_print_table_row(2, "Libzip version", "0.7.1");
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php