diff --git a/NEWS b/NEWS index 12290452775..6b8fb5a68a5 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ PHP NEWS - Phar: . Fix memory leak of argument in webPhar. (nielsdos) . Fix memory leak when setAlias() fails. (nielsdos) + . Fix memory leak in phar_parse_zipfile() error handling. (nielsdos) - Random: . Fix Randomizer::__serialize() w.r.t. INDIRECTs. (nielsdos) diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 9a98b541ff6..8c4ec378765 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -673,7 +673,8 @@ foundit: } } - if (!entry.uncompressed_filesize || !actual_alias) { + if (!entry.uncompressed_filesize) { + efree(actual_alias); php_stream_filter_remove(filter, 1); pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); @@ -706,7 +707,8 @@ foundit: } } - if (!entry.uncompressed_filesize || !actual_alias) { + if (!entry.uncompressed_filesize) { + efree(actual_alias); php_stream_filter_remove(filter, 1); pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); @@ -729,7 +731,8 @@ foundit: } } - if (!entry.uncompressed_filesize || !actual_alias) { + if (!entry.uncompressed_filesize) { + efree(actual_alias); pefree(entry.filename, entry.is_persistent); PHAR_ZIP_FAIL("unable to read in alias, truncated"); }