From 708ac9f76da507751dd6d80e240e47b74fe9a1b8 Mon Sep 17 00:00:00 2001 From: Sami Kortelainen Date: Tue, 29 Sep 2026 14:54:21 +0300 Subject: Fixed memory handling. Fixed to release mutex on error. Fixed use-after-free on ipsw zip. --- src/ipsw.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/ipsw.c') diff --git a/src/ipsw.c b/src/ipsw.c index cebfa49..9eeaab1 100644 --- a/src/ipsw.c +++ b/src/ipsw.c @@ -683,13 +683,15 @@ int ipsw_extract_to_memory(ipsw_archive_t ipsw, const char* infile, void** pbuff } zip_int64_t zr = zip_fread(zfile, buffer, size); + int zep = 0; + int sep = 0; + if (zr < 0) { + zip_file_error_get(zfile, &zep, &sep); + } zip_fclose(zfile); zip_unchange_all(zip); zip_close(zip); if (zr < 0) { - int zep = 0; - int sep = 0; - zip_file_error_get(zfile, &zep, &sep); logger(LL_ERROR, "zip_fread: %s %d %d\n", infile, zep, sep); free(buffer); return -1; -- cgit v1.1-32-gdbae