kernel32: fix handle leak
Pierre Schweitzer
pierre at reactos.org
Fri Dec 30 15:04:03 CST 2011
-------------- next part --------------
>From 9fd46e40cf0bc92b5878ff5b4a3e79e57e06be60 Mon Sep 17 00:00:00 2001
From: Pierre Schweitzer <pierre at reactos.org>
Date: Fri, 30 Dec 2011 21:54:31 +0100
Subject: kernel32: Fix handle leak.
---
dlls/kernel32/console.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 2ca74c9..dba5ff2 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -1998,6 +1998,8 @@ static DWORD WINAPI CONSOLE_SendEventThread(void* pmt)
*/
int CONSOLE_HandleCtrlC(unsigned sig)
{
+ HANDLE hThread;
+
/* FIXME: better test whether a console is attached to this process ??? */
extern unsigned CONSOLE_GetNumHistoryEntries(void);
if (CONSOLE_GetNumHistoryEntries() == (unsigned)-1) return 0;
@@ -2014,7 +2016,11 @@ int CONSOLE_HandleCtrlC(unsigned sig)
* console critical section, we need another execution environment where
* we can wait on this critical section
*/
- CreateThread(NULL, 0, CONSOLE_SendEventThread, (void*)CTRL_C_EVENT, 0, NULL);
+ hThread = CreateThread(NULL, 0, CONSOLE_SendEventThread, (void*)CTRL_C_EVENT, 0, NULL);
+ if (hThread == NULL)
+ return 0;
+
+ CloseHandle(hThread);
}
return 1;
}
--
1.7.4.1
More information about the wine-patches
mailing list