Skip to content

Commit c2a0023

Browse files
committed
Fix thread handle leak on Windows
1 parent 11a548b commit c2a0023

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/Support/Windows/Threading.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ llvm_execute_on_thread_impl(unsigned(__stdcall *ThreadFunc)(void *), void *Arg,
4040
void llvm_thread_join_impl(HANDLE hThread) {
4141
if (::WaitForSingleObject(hThread, INFINITE) == WAIT_FAILED)
4242
ReportLastErrorFatal("WaitForSingleObject failed");
43+
if (::CloseHandle(hThread) == FALSE)
44+
ReportLastErrorFatal("CloseHandle failed");
4345
}
4446

4547
void llvm_thread_detach_impl(HANDLE hThread) {

0 commit comments

Comments
 (0)