1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 09:58:01 +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:
Simon Tatham 2015-02-07 11:48:19 +00:00
parent 8dedf59080
commit 7549f2da40

View File

@ -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)