From a87c56faea8962de5951c5409d8f41647b08c875 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Mon, 3 Dec 2012 20:53:18 +0100 Subject: [PATCH 1/1] Fix thread handle leak in StartServiceThread() --- win/win32service.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/win/win32service.cpp b/win/win32service.cpp index b04eff558..0a4b0c5b4 100644 --- a/win/win32service.cpp +++ b/win/win32service.cpp @@ -113,8 +113,9 @@ void SetServiceRunning() /** Starts the worker thread above */ void StartServiceThread() { - DWORD dwd; - CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WorkerThread,NULL,0,&dwd); + HANDLE hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WorkerThread,NULL,0,NULL); + if (hThread != NULL) + CloseHandle(hThread); } /** This function updates the status of the service in the SCM -- 2.39.2