Index: dplobby.c
===================================================================
RCS file: /home/wine/wine/dlls/dplayx/dplobby.c,v
retrieving revision 1.39
diff -u -r1.39 dplobby.c
--- dplobby.c	26 Jan 2005 21:09:05 -0000	1.39
+++ dplobby.c	9 Mar 2005 08:03:27 -0000
@@ -1156,22 +1156,18 @@
                                    LPHANDLE lphRead )
 {
   /* These are the handles for the created process */
-  HANDLE hAppStart, hAppDeath, hAppRead, hTemp;
+  HANDLE hAppStart = INVALID_HANDLE_VALUE;
+  HANDLE hAppDeath = INVALID_HANDLE_VALUE;
+  HANDLE hAppRead  = INVALID_HANDLE_VALUE;
   SECURITY_ATTRIBUTES s_attrib;
 
   s_attrib.nLength              = sizeof( s_attrib );
   s_attrib.lpSecurityDescriptor = NULL;
   s_attrib.bInheritHandle       = TRUE;
 
-  /* FIXME: Is there a handle leak here? */
-  hTemp = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
-  *lphStart = ConvertToGlobalHandle( hTemp );
-
-  hTemp = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
-  *lphDeath = ConvertToGlobalHandle( hTemp );
-
-  hTemp = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
-  *lphRead  = ConvertToGlobalHandle( hTemp );
+  *lphStart = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
+  *lphDeath = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
+  *lphRead  = CreateEventW( &s_attrib, TRUE, FALSE, NULL );
 
   if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart,
                           hDestProcess, &hAppStart,
@@ -1184,6 +1180,9 @@
                           0, FALSE, DUPLICATE_SAME_ACCESS ) )
     )
   {
+    if (INVALID_HANDLE_VALUE != *lphStart) { CloseHandle(*lphStart); *lphStart = INVALID_HANDLE_VALUE; }
+    if (INVALID_HANDLE_VALUE != *lphDeath) { CloseHandle(*lphDeath); *lphDeath = INVALID_HANDLE_VALUE; }
+    if (INVALID_HANDLE_VALUE != *lphRead)  { CloseHandle(*lphRead);  *lphRead  = INVALID_HANDLE_VALUE; }
     /* FIXME: Handle leak... */
     ERR( "Unable to dup handles\n" );
     return FALSE;
@@ -1192,6 +1191,7 @@
   if( !DPLAYX_SetLobbyHandles( dwDestProcessId,
                                hAppStart, hAppDeath, hAppRead ) )
   {
+    /* FIXME: Handle leak... */
     return FALSE;
   }
 
