]> granicus.if.org Git - php/commitdiff
fix memleaks on zip corruption
authorGreg Beaver <cellog@php.net>
Mon, 16 Feb 2009 18:55:06 +0000 (18:55 +0000)
committerGreg Beaver <cellog@php.net>
Mon, 16 Feb 2009 18:55:06 +0000 (18:55 +0000)
ext/phar/zip.c

index f0aa483d9813f3d7d087c93dc83150891f84b639..528e95c2ade5534dcacbcc5e21455b421cbd4c22 100644 (file)
@@ -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)");
                        }