Pierre Schweitzer : kernel32: Fix handle leak.

Alexandre Julliard julliard at winehq.org
Tue Jan 3 12:52:54 CST 2012


Module: wine
Branch: master
Commit: 8ed701b3c6536c555e8e90c6a899edaacb3b6d0a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8ed701b3c6536c555e8e90c6a899edaacb3b6d0a

Author: Pierre Schweitzer <pierre at reactos.org>
Date:   Fri Dec 30 21:54:31 2011 +0100

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..fdc4552 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 thread;
+
     /* 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);
+        thread = CreateThread(NULL, 0, CONSOLE_SendEventThread, (void*)CTRL_C_EVENT, 0, NULL);
+        if (thread == NULL)
+            return 0;
+
+        CloseHandle(thread);
     }
     return 1;
 }




More information about the wine-cvs mailing list