From 5863d139dbee15891c4c345e6cf16b95a565d85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mielicki?= Date: Tue, 3 Jun 2025 12:48:37 +0200 Subject: [PATCH] Fix thread handle leak on Windows --- llvm/lib/Support/Windows/Threading.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/lib/Support/Windows/Threading.inc b/llvm/lib/Support/Windows/Threading.inc index 4baf8b8cb82a..699cfedd89ca 100644 --- a/llvm/lib/Support/Windows/Threading.inc +++ b/llvm/lib/Support/Windows/Threading.inc @@ -41,6 +41,9 @@ void llvm_thread_join_impl(HANDLE hThread) { if (::WaitForSingleObject(hThread, INFINITE) == WAIT_FAILED) { ReportLastErrorFatal("WaitForSingleObject failed"); } + if (::CloseHandle(hThread) == FALSE) { + ReportLastErrorFatal("CloseHandle failed"); + } } void llvm_thread_detach_impl(HANDLE hThread) {