From ad927f58e377410c35ee1f4d1c78dc238320ea8b Mon Sep 17 00:00:00 2001 From: kbinani Date: Tue, 27 Aug 2024 05:49:40 +0900 Subject: [PATCH] Fix possible memory leak within readChunk --- Sources/ZIPFoundation/Data+Serialization.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/ZIPFoundation/Data+Serialization.swift b/Sources/ZIPFoundation/Data+Serialization.swift index f008a9ae..12340f90 100644 --- a/Sources/ZIPFoundation/Data+Serialization.swift +++ b/Sources/ZIPFoundation/Data+Serialization.swift @@ -84,6 +84,7 @@ extension Data { let bytesRead = fread(bytes, 1, size, file) let error = ferror(file) if error > 0 { + bytes.deallocate() throw DataError.unreadableFile } #if swift(>=4.1)