mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Fix handle leak in winhandl.c.
The code for cleaning up handle structures works by the main thread asking the per-handle subthread to shut down by means of setting its 'done' flag, and then once the subthread signals back through its event object that it's done so, the main thread frees all its resources and removes the event object from the list of things being checked in the program's event loop. But read threads were not sending back that final event acknowledging a request to shut down, so their event objects were never being cleaned up. Bug spotted by Ronald Weiss.
This commit is contained in:
parent
8dedf59080
commit
7549f2da40
@ -171,8 +171,10 @@ static DWORD WINAPI handle_input_threadfunc(void *param)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
WaitForSingleObject(ctx->ev_from_main, INFINITE);
|
WaitForSingleObject(ctx->ev_from_main, INFINITE);
|
||||||
if (ctx->done)
|
if (ctx->done) {
|
||||||
|
SetEvent(ctx->ev_to_main);
|
||||||
break; /* main thread told us to shut down */
|
break; /* main thread told us to shut down */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (povl)
|
if (povl)
|
||||||
|
Loading…
Reference in New Issue
Block a user