sc: Fix service handle leak on error path (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-11-22 17:48:04 +03:00 committed by Alexandre Julliard
parent 53a065ae0a
commit 0a3e54480a

View File

@ -285,15 +285,14 @@ int wmain( int argc, const WCHAR *argv[] )
if (service)
{
SERVICE_FAILURE_ACTIONSW sfa;
if (!parse_failure_params( argc - 3, argv + 3, &sfa ))
if (parse_failure_params( argc - 3, argv + 3, &sfa ))
{
WINE_WARN("failed to parse failure parameters\n");
CloseServiceHandle( manager );
return 1;
ret = ChangeServiceConfig2W( service, SERVICE_CONFIG_FAILURE_ACTIONS, &sfa );
if (!ret) WINE_TRACE("failed to set service failure actions %u\n", GetLastError());
HeapFree( GetProcessHeap(), 0, sfa.lpsaActions );
}
ret = ChangeServiceConfig2W( service, SERVICE_CONFIG_FAILURE_ACTIONS, &sfa );
if (!ret) WINE_TRACE("failed to set service failure actions %u\n", GetLastError());
HeapFree( GetProcessHeap(), 0, sfa.lpsaActions );
else
WINE_WARN("failed to parse failure parameters\n");
CloseServiceHandle( service );
}
else WINE_TRACE("failed to open service %u\n", GetLastError());