From a0afc540d0820b610bdf90c5e1ab67353bc2c490 Mon Sep 17 00:00:00 2001 From: MysterD Date: Mon, 10 Apr 2023 14:59:29 -0700 Subject: [PATCH] Cleanup zip file in more failure scenarios --- src/pc/mods/mod_import.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pc/mods/mod_import.c b/src/pc/mods/mod_import.c index ce2ad599..2831d4c2 100644 --- a/src/pc/mods/mod_import.c +++ b/src/pc/mods/mod_import.c @@ -99,6 +99,7 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) { snprintf(dstDirectory, SYS_MAX_PATH, "%s", (char*)fs_get_write_path(DYNOS_PACKS_FOLDER)); } else { LOG_ERROR("Could not figure out what type of mod this is"); + mz_zip_reader_end(&zip_archive); return false; } if (!fs_sys_dir_exists(dstDirectory)) { @@ -159,6 +160,8 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) { FILE* fout = fopen(dst, "wb"); if (fout == NULL) { LOG_ERROR("Failed to open dst path for zip mod import"); + mz_free((void*)p); + mz_zip_reader_end(&zip_archive); return false; }