Author: pschweitzer Date: Tue Dec 20 16:37:21 2011 New Revision: 54709
URL: http://svn.reactos.org/svn/reactos?rev=54709&view=rev Log: [TELNETD] Fix handle leaks
Modified: trunk/reactos/base/services/telnetd/telnetd.c
Modified: trunk/reactos/base/services/telnetd/telnetd.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/services/telnetd/telne... ============================================================================== --- trunk/reactos/base/services/telnetd/telnetd.c [iso-8859-1] (original) +++ trunk/reactos/base/services/telnetd/telnetd.c [iso-8859-1] Tue Dec 20 16:37:21 2011 @@ -359,7 +359,7 @@ */ static void RunShell(client_t *client) { - DWORD threadID; + HANDLE threadHandle; HANDLE hChildStdinRd; HANDLE hChildStdinWr; HANDLE hChildStdoutRd; @@ -432,9 +432,17 @@ if (!CloseHandle(hChildStdinRd)) ErrorExit("Closing handle failed");
- CreateThread(NULL, 0, WriteToPipeThread, client, 0, &threadID); - CreateThread(NULL, 0, ReadFromPipeThread, client, 0, &threadID); - CreateThread(NULL, 0, MonitorChildThread, client, 0, &threadID); + threadHandle = CreateThread(NULL, 0, WriteToPipeThread, client, 0, NULL); + if (threadHandle != NULL) + 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); }
/*