From 5bfb6a15447249bc3a0e2bc32e73fbde3187f980 Mon Sep 17 00:00:00 2001 From: korenkonder Date: Wed, 31 Jan 2024 17:10:42 +0300 Subject: [PATCH] Fixed memory leak in gzip compression --- src/KKdLib/deflate.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/KKdLib/deflate.cpp b/src/KKdLib/deflate.cpp index 24c95078..84a6f670 100644 --- a/src/KKdLib/deflate.cpp +++ b/src/KKdLib/deflate.cpp @@ -62,6 +62,9 @@ namespace deflate { memcpy((void*)(t + 0x0A), file_name, file_name_length + 1); memcpy((void*)(t + 0x0A + file_name_length + 1), (void*)(d + 0x0A), *dst_length - 0x0A); ((uint8_t*)t)[0x03] |= 0x08; + free(*dst); + *dst = temp; + *dst_length += file_name_length + 1; return result; }