[TELNETD]

Fix handle leaks

svn path=/trunk/; revision=54709
This commit is contained in:
Pierre Schweitzer 2011-12-20 16:37:21 +00:00
parent 0f0ba6a559
commit a16e45a07d

View file

@ -359,7 +359,7 @@ static int ReceiveLine(int sock, char *buffer, int len, EchoMode echo)
*/ */
static void RunShell(client_t *client) static void RunShell(client_t *client)
{ {
DWORD threadID; HANDLE threadHandle;
HANDLE hChildStdinRd; HANDLE hChildStdinRd;
HANDLE hChildStdinWr; HANDLE hChildStdinWr;
HANDLE hChildStdoutRd; HANDLE hChildStdoutRd;
@ -432,9 +432,17 @@ static void RunShell(client_t *client)
if (!CloseHandle(hChildStdinRd)) if (!CloseHandle(hChildStdinRd))
ErrorExit("Closing handle failed"); ErrorExit("Closing handle failed");
CreateThread(NULL, 0, WriteToPipeThread, client, 0, &threadID); threadHandle = CreateThread(NULL, 0, WriteToPipeThread, client, 0, NULL);
CreateThread(NULL, 0, ReadFromPipeThread, client, 0, &threadID); if (threadHandle != NULL)
CreateThread(NULL, 0, MonitorChildThread, client, 0, &threadID); CloseHandle(threadHandle);
threadHandle = CreateThread(NULL, 0, ReadFromPipeThread, client, 0, NULL);
if (threadHandle != NULL)
CloseHandle(threadHandle);
threadHandle = CreateThread(NULL, 0, MonitorChildThread, client, 0, NULL);
if (threadHandle != NULL)
CloseHandle(threadHandle);
} }
/* /*