diff options
author | Andrew Pinski <pinskia@gmail.com> | 2007-01-23 21:46:09 -0800 |
---|---|---|
committer | Andrew Pinski <pinskia@gcc.gnu.org> | 2007-01-23 21:46:09 -0800 |
commit | a5abc980c2ec7708e5e8342e0caedb19b05b2ac1 (patch) | |
tree | 8e5d2f0e9aff2987fe548c2c5321ddda90c3b682 /gcc/java/jcf-io.c | |
parent | fc376903292da0a47025435755ab21dd6aa7dd4c (diff) | |
download | gcc-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/jcf-io.c')
-rw-r--r-- | gcc/java/jcf-io.c | 12 |
1 files changed, 10 insertions, 2 deletions
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; |