net: Don't call CloseServiceHandle() with an invalid handle.

This commit is contained in:
Huw Davies 2015-07-16 11:56:07 +01:00 committed by Alexandre Julliard
parent fed41f5306
commit 3e7f0e685b
1 changed files with 5 additions and 2 deletions

View File

@ -220,8 +220,11 @@ static BOOL StopService(SC_HANDLE SCManager, SC_HANDLE serviceHandle)
{
output_string(STRING_STOP_DEP, dependencies[counter].lpDisplayName);
dependent_serviceHandle = OpenServiceW(SCManager, dependencies[counter].lpServiceName, SC_MANAGER_ALL_ACCESS);
if(dependent_serviceHandle) result = StopService(SCManager, dependent_serviceHandle);
CloseServiceHandle(dependent_serviceHandle);
if(dependent_serviceHandle)
{
result = StopService(SCManager, dependent_serviceHandle);
CloseServiceHandle(dependent_serviceHandle);
}
if(!result) output_string(STRING_CANT_STOP, dependencies[counter].lpDisplayName);
}
}