Commit a5abc980 by Andrew Pinski Committed by Andrew Pinski

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
parent fc376903
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> 2007-01-16 Tom Tromey <tromey@redhat.com>
* java-tree.def: Added copyright header. * java-tree.def: Added copyright header.
......
...@@ -134,11 +134,19 @@ opendir_in_zip (const char *zipfile, int is_system) ...@@ -134,11 +134,19 @@ opendir_in_zip (const char *zipfile, int is_system)
{ {
jcf_dependency_add_file (zipfile, is_system); jcf_dependency_add_file (zipfile, is_system);
if (read (fd, magic, 4) != 4 || GET_u4 (magic) != (JCF_u4)ZIPMAGIC) if (read (fd, magic, 4) != 4 || GET_u4 (magic) != (JCF_u4)ZIPMAGIC)
{
free (zipf);
close (fd);
return NULL; return NULL;
}
lseek (fd, 0L, SEEK_SET); lseek (fd, 0L, SEEK_SET);
if (read_zip_archive (zipf) != 0) if (read_zip_archive (zipf) != 0)
{
free (zipf);
close (fd);
return NULL; return NULL;
} }
}
SeenZipFiles = zipf; SeenZipFiles = zipf;
return zipf; return zipf;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment