mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 20:42:48 -05:00
Close all thread handles returned from CreateThread.
If you don't, they are permanently leaked. A user points out that this is particularly bad in Pageant, with the new named-pipe-based IPC, since it will spawn an input and output I/O thread per named pipe connection, leading to two handles being leaked every time.
This commit is contained in:
@ -1631,8 +1631,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
DWORD wm_copydata_threadid;
|
||||
wmct.ev_msg_ready = CreateEvent(NULL, false, false, NULL);
|
||||
wmct.ev_reply_ready = CreateEvent(NULL, false, false, NULL);
|
||||
CreateThread(NULL, 0, wm_copydata_threadfunc,
|
||||
&inst, 0, &wm_copydata_threadid);
|
||||
HANDLE hThread = CreateThread(NULL, 0, wm_copydata_threadfunc,
|
||||
&inst, 0, &wm_copydata_threadid);
|
||||
if (hThread)
|
||||
CloseHandle(hThread); /* we don't need the thread handle */
|
||||
add_handle_wait(wmct.ev_msg_ready, wm_copydata_got_msg, NULL);
|
||||
|
||||
if (show_keylist_on_startup)
|
||||
|
Reference in New Issue
Block a user