From 0b7d3070b97e574f81ac0e7a8ed6c429dcb1fc1e Mon Sep 17 00:00:00 2001 From: "T. Isaac Lightburn" Date: Thu, 12 Oct 2017 21:29:43 -0500 Subject: [PATCH] Fix resource leak in mz_zip_reader_init_file_v2 Was returning on error without closing file. --- miniz_zip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/miniz_zip.c b/miniz_zip.c index 18b6dbf..da62c6b 100644 --- a/miniz_zip.c +++ b/miniz_zip.c @@ -978,7 +978,10 @@ mz_bool mz_zip_reader_init_file_v2(mz_zip_archive *pZip, const char *pFilename, /* TODO: Better sanity check archive_size and the # of actual remaining bytes */ if (file_size < MZ_ZIP_END_OF_CENTRAL_DIR_HEADER_SIZE) + { + MZ_FCLOSE(pFile); return mz_zip_set_error(pZip, MZ_ZIP_NOT_AN_ARCHIVE); + } if (!mz_zip_reader_init_internal(pZip, flags)) {