From: Greg Beaver Date: Mon, 16 Feb 2009 18:55:19 +0000 (+0000) Subject: MFB: fix memleaks on zip corruption X-Git-Tag: php-5.4.0alpha1~191^2~4261 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4eed2d8ffcf1e8d5110afb56c982e381ec35995b;p=php MFB: fix memleaks on zip corruption --- diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 0beed2ecde..48e938d25e 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -480,11 +480,13 @@ foundit: php_stream_seek(fp, PHAR_GET_32(zipentry.offset), SEEK_SET); if (sizeof(local) != php_stream_read(fp, (char *) &local, sizeof(local))) { + pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("phar error: internal corruption of zip-based phar (cannot read local file header for alias)"); } /* verify local header */ if (entry.filename_len != PHAR_GET_16(local.filename_len) || entry.crc32 != PHAR_GET_32(local.crc32) || entry.uncompressed_filesize != PHAR_GET_32(local.uncompsize) || entry.compressed_filesize != PHAR_GET_32(local.compsize)) { + pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("phar error: internal corruption of zip-based phar (local head of alias does not match central directory)"); }