[WBEMPROX] Sync with Wine Staging 1.7.55. CORE-10536
[reactos.git] / reactos / dll / win32 / wbemprox / service.c
index a399a85..6c09f76 100644 (file)
@@ -56,11 +56,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;
 }
 
@@ -170,11 +170,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;
 }