pajoye Mon Oct 30 17:28:29 2006 UTC
Modified files:
/php-src/ext/zip php_zip.c
Log:
- fix leak in statName and statIndex
- use zip_locate_name instead of zip_stat in setCommentName (faster and
work around for a possible bug)
http://cvs.php.net/viewvc.cgi/php-src/ext/zip/php_zip.c?r1=1.20&r2=1.21&diff_format=u
Index: php-src/ext/zip/php_zip.c
diff -u php-src/ext/zip/php_zip.c:1.20 php-src/ext/zip/php_zip.c:1.21
--- php-src/ext/zip/php_zip.c:1.20 Wed Oct 25 12:32:10 2006
+++ php-src/ext/zip/php_zip.c Mon Oct 30 17:28:29 2006
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zip.c,v 1.20 2006/10/25 12:32:10 bjori Exp $ */
+/* $Id: php_zip.c,v 1.21 2006/10/30 17:28:29 pajoye Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -183,7 +183,7 @@
#define RETURN_SB(sb) \
{ \
array_init(return_value); \
- add_assoc_string(return_value, "name", estrdup((sb)->name), 0);
\
+ add_assoc_string(return_value, "name", (char *)(sb)->name, 1); \
add_assoc_long(return_value, "index", (long) (sb)->index); \
add_assoc_long(return_value, "crc", (long) (sb)->crc); \
add_assoc_long(return_value, "size", (long) (sb)->size); \
@@ -1250,7 +1250,7 @@
zval *this = getThis();
int comment_len, name_len;
char * comment, *name;
- struct zip_stat sb;
+ int idx;
if (!this) {
RETURN_FALSE;
@@ -1263,9 +1263,11 @@
return;
}
-
- PHP_ZIP_STAT_PATH(intern, name, name_len, 0, sb);
- PHP_ZIP_SET_FILE_COMMENT(intern, sb.index, comment, comment_len);
+ idx = zip_name_locate(intern, name, 0);
+ if (idx < 0) {
+ RETURN_FALSE;
+ }
+ PHP_ZIP_SET_FILE_COMMENT(intern, idx, comment, comment_len);
}
/* }}} */
@@ -1937,7 +1939,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.20
2006/10/25 12:32:10 bjori Exp $");
+ php_info_print_table_row(2, "Extension Version","$Id: php_zip.c,v 1.21
2006/10/30 17:28:29 pajoye 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