I thought INVALID_HANDLE_VALUE==-1 and not 0. Moreover, I can't see any code path leading to ERR where handle is allocated (or assigned to) at all so I think there is no need to close it.

Mike Hearn wrote:
Mike Hearn <[EMAIL PROTECTED]>
Don't close uninitialized handle on VXD error path

diff --git a/dlls/kernel/vxd.c b/dlls/kernel/vxd.c
index 5d16684..2a004a0 100644
--- a/dlls/kernel/vxd.c
+++ b/dlls/kernel/vxd.c
@@ -179,7 +179,7 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWOR
 {
     static const WCHAR dotVxDW[] = {'.','v','x','d',0};
     int i;
-    HANDLE handle;
+    HANDLE handle = INVALID_HANDLE_VALUE;
     HMODULE module;
     WCHAR *p, name[16];
@@ -254,10 +254,14 @@ HANDLE VXD_Open( LPCWSTR filenameW, DWOR
     }
ERR("too many open VxD modules, please report\n" );
-    CloseHandle( handle );
+ + if (handle)
+    {
+        CloseHandle( handle );
+        handle = 0;
+    }
     FreeLibrary( module );
-    handle = 0;
-
+ done:
     RtlLeaveCriticalSection( &vxd_section );
     if (!DuplicateHandle( GetCurrentProcess(), handle, GetCurrentProcess(), 
&handle, 0,







Reply via email to