Author: pschweitzer
Date: Tue Dec 20 16:19:58 2011
New Revision: 54708
URL:
http://svn.reactos.org/svn/reactos?rev=54708&view=rev
Log:
[TELNETD]
Fix handle leak
Fix memory leak
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/teln…
==============================================================================
--- 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:19:58 2011
@@ -137,14 +137,18 @@
/* Function: UserLogin */
static void UserLogin(int client_socket)
{
- DWORD threadID;
+ HANDLE threadHandle;
client_t *client = malloc(sizeof(client_t));
if (client == NULL)
ErrorExit("failed to allocate memory for client");
client->socket = client_socket;
- CreateThread(NULL, 0, UserLoginThread, client, 0, &threadID);
+ threadHandle = CreateThread(NULL, 0, UserLoginThread, client, 0, NULL);
+ if (threadHandle == NULL)
+ free(client);
+ else
+ CloseHandle(threadHandle);
}
/* Function: UserLoginThread */