mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 14:02:47 -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:
@ -1160,13 +1160,15 @@ static void start_generating_key(HWND hwnd, struct MainDlgState *state)
|
||||
params->key = &state->key;
|
||||
params->dsakey = &state->dsakey;
|
||||
|
||||
if (!CreateThread(NULL, 0, generate_key_thread,
|
||||
params, 0, &threadid)) {
|
||||
HANDLE hThread = CreateThread(NULL, 0, generate_key_thread,
|
||||
params, 0, &threadid);
|
||||
if (!hThread) {
|
||||
MessageBox(hwnd, "Out of thread resources",
|
||||
"Key generation error",
|
||||
MB_OK | MB_ICONERROR);
|
||||
sfree(params);
|
||||
} else {
|
||||
CloseHandle(hThread); /* we don't need the thread handle */
|
||||
state->generation_thread_exists = true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user