From 6c5aac0da6f0ddb193ebbe92de9fbe0904888143 Mon Sep 17 00:00:00 2001 From: Benjamin Oldenburg Date: Fri, 20 Mar 2026 16:42:21 +0700 Subject: [PATCH] tccpe.c: fix msvcrt.dll handle leak on Windows ARM64 pe_get_process_msvcrt_handle() used LoadLibraryA which increments the module reference count, but never called FreeLibrary to release it. Use GetModuleHandleA instead, which returns a handle to the already- loaded msvcrt.dll module without incrementing the reference count. This is the correct API for accessing system DLLs that are already mapped into the process address space. --- tccpe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tccpe.c b/tccpe.c index f78f7cd4..012c3686 100644 --- a/tccpe.c +++ b/tccpe.c @@ -40,7 +40,7 @@ static HMODULE pe_get_process_msvcrt_handle(void) wait_sem(&pe_msvcrt_sem); dll = handle; if (!dll) { - dll = LoadLibraryA("msvcrt.dll"); + dll = GetModuleHandleA("msvcrt.dll"); if (dll) handle = dll; }