From 0f0ba6a559d7b01b1b037ce95be55bc73e6887b3 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 20 Dec 2011 16:19:58 +0000 Subject: [PATCH] [TELNETD] Fix handle leak Fix memory leak svn path=/trunk/; revision=54708 --- reactos/base/services/telnetd/telnetd.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reactos/base/services/telnetd/telnetd.c b/reactos/base/services/telnetd/telnetd.c index 6a6d24a6bd5..3dc8886d3b1 100644 --- a/reactos/base/services/telnetd/telnetd.c +++ b/reactos/base/services/telnetd/telnetd.c @@ -137,14 +137,18 @@ static void WaitForConnect(void) /* 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 */