Pierre Schweitzer : dplayx: Fix handle leak.

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


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

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

dplayx: Fix handle leak.

---

 dlls/dplayx/dplayx_messages.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/dlls/dplayx/dplayx_messages.c b/dlls/dplayx/dplayx_messages.c
index 2e34950..8b9320d 100644
--- a/dlls/dplayx/dplayx_messages.c
+++ b/dlls/dplayx/dplayx_messages.c
@@ -58,6 +58,7 @@ DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart,
 {
   DWORD           dwMsgThreadId;
   LPMSGTHREADINFO lpThreadInfo;
+  HANDLE          hThread;
 
   lpThreadInfo = HeapAlloc( GetProcessHeap(), 0, sizeof( *lpThreadInfo ) );
   if( lpThreadInfo == NULL )
@@ -83,21 +84,20 @@ DWORD CreateLobbyMessageReceptionThread( HANDLE hNotifyEvent, HANDLE hStart,
   lpThreadInfo->hDeath       = hDeath;
   lpThreadInfo->hSettingRead = hConnRead;
 
-  if( !CreateThread( NULL,                  /* Security attribs */
-                     0,                     /* Stack */
-                     DPL_MSG_ThreadMain,    /* Msg reception function */
-                     lpThreadInfo,          /* Msg reception func parameter */
-                     0,                     /* Flags */
-                     &dwMsgThreadId         /* Updated with thread id */
-                   )
-    )
+  hThread = CreateThread( NULL,                  /* Security attribs */
+                          0,                     /* Stack */
+                          DPL_MSG_ThreadMain,    /* Msg reception function */
+                          lpThreadInfo,          /* Msg reception func parameter */
+                          0,                     /* Flags */
+                          &dwMsgThreadId         /* Updated with thread id */
+                        );
+  if ( hThread == NULL )
   {
     ERR( "Unable to create msg thread\n" );
     goto error;
   }
 
-  /* FIXME: Should I be closing the handle to the thread or does that
-            terminate the thread? */
+  CloseHandle(hThread);
 
   return dwMsgThreadId;
 




More information about the wine-cvs mailing list