[PATCH 4/4] wbemprox: Don't call CloseServiceHandle() with an invalid handle.

Huw Davies huw at codeweavers.com
Thu Jul 16 05:56:08 CDT 2015


---
 dlls/wbemprox/service.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/wbemprox/service.c b/dlls/wbemprox/service.c
index 95a21b5..b096c5c 100644
--- a/dlls/wbemprox/service.c
+++ b/dlls/wbemprox/service.c
@@ -69,11 +69,11 @@ static HRESULT control_service( const WCHAR *name, DWORD control, VARIANT *retva
         goto done;
     }
     if (!ControlService( service, control, &status )) error = map_error( GetLastError() );
+    CloseServiceHandle( service );
 
 done:
     set_variant( VT_UI4, error, NULL, retval );
-    CloseServiceHandle( service );
-    CloseServiceHandle( manager );
+    if (manager) CloseServiceHandle( manager );
     return S_OK;
 }
 
@@ -183,11 +183,11 @@ static HRESULT start_service( const WCHAR *name, VARIANT *retval )
         goto done;
     }
     if (!StartServiceW( service, 0, NULL )) error = map_error( GetLastError() );
+    CloseServiceHandle( service );
 
 done:
     set_variant( VT_UI4, error, NULL, retval );
-    CloseServiceHandle( service );
-    CloseServiceHandle( manager );
+    if (manager) CloseServiceHandle( manager );
     return S_OK;
 }
 
-- 
1.8.0




More information about the wine-patches mailing list