From c92f818a3c5564afee40118da39dce8fba5e75a1 Mon Sep 17 00:00:00 2001 From: def Date: Sun, 28 Feb 2021 23:14:22 +0100 Subject: [PATCH] Don't leak memory on Windows in logger MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to 拓真 on Discord for report --- src/base/system.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/base/system.c b/src/base/system.c index b0781758e..543b68020 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -177,10 +177,16 @@ static void logger_stdout_sync(const char *line, void *user) char u16[4] = {0}; if(codepoint < 0) + { + free(wide); return; + } if(str_utf16le_encode(u16, codepoint) != 2) + { + free(wide); return; + } mem_copy(&wide[wlen], u16, 2); }