From: Andrew Pinski Date: Wed, 24 Jan 2007 05:46:09 +0000 (-0800) Subject: re PR java/30454 (empty "zip" file in class path can cause leakage of file streams) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5abc980c2ec7708e5e8342e0caedb19b05b2ac1;p=platform%2Fupstream%2Fgcc.git re PR java/30454 (empty "zip" file in class path can cause leakage of file streams) 2007-01-23 Andrew Pinski PR java/30454 * jcf-io.c (opendir_in_zip): Close the file and free zipf before returning after an error. From-SVN: r121101 --- diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index b26cba7..3702984 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2007-01-23 Andrew Pinski + + PR java/30454 + * jcf-io.c (opendir_in_zip): Close the file + and free zipf before returning after an error. + 2007-01-16 Tom Tromey * java-tree.def: Added copyright header. diff --git a/gcc/java/jcf-io.c b/gcc/java/jcf-io.c index 27b9103..0c9b07b 100644 --- a/gcc/java/jcf-io.c +++ b/gcc/java/jcf-io.c @@ -134,10 +134,18 @@ opendir_in_zip (const char *zipfile, int is_system) { jcf_dependency_add_file (zipfile, is_system); if (read (fd, magic, 4) != 4 || GET_u4 (magic) != (JCF_u4)ZIPMAGIC) - return NULL; + { + free (zipf); + close (fd); + return NULL; + } lseek (fd, 0L, SEEK_SET); if (read_zip_archive (zipf) != 0) - return NULL; + { + free (zipf); + close (fd); + return NULL; + } } SeenZipFiles = zipf;