aboutsummaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gmail.com>2007-01-23 21:46:09 -0800
committerAndrew Pinski <pinskia@gcc.gnu.org>2007-01-23 21:46:09 -0800
commita5abc980c2ec7708e5e8342e0caedb19b05b2ac1 (patch)
tree8e5d2f0e9aff2987fe548c2c5321ddda90c3b682 /gcc/java
parentfc376903292da0a47025435755ab21dd6aa7dd4c (diff)
downloadgcc-a5abc980c2ec7708e5e8342e0caedb19b05b2ac1.zip
gcc-a5abc980c2ec7708e5e8342e0caedb19b05b2ac1.tar.gz
gcc-a5abc980c2ec7708e5e8342e0caedb19b05b2ac1.tar.bz2
re PR java/30454 (empty "zip" file in class path can cause leakage of file streams)
2007-01-23 Andrew Pinski <pinskia@gmail.com> PR java/30454 * jcf-io.c (opendir_in_zip): Close the file and free zipf before returning after an error. From-SVN: r121101
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/jcf-io.c12
2 files changed, 16 insertions, 2 deletions
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 <pinskia@gmail.com>
+
+ 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 <tromey@redhat.com>
* 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;