advapi/service: Fix possible handle leak.

This commit is contained in:
Paul Vriens 2007-07-11 20:43:01 +02:00 committed by Alexandre Julliard
parent 05fec6c871
commit 13b3b724c6
1 changed files with 3 additions and 0 deletions

View File

@ -1262,7 +1262,10 @@ SC_HANDLE WINAPI OpenServiceW( SC_HANDLE hSCManager, LPCWSTR lpServiceName,
sizeof (struct sc_service) + len*sizeof(WCHAR), sizeof (struct sc_service) + len*sizeof(WCHAR),
sc_handle_destroy_service ); sc_handle_destroy_service );
if (!hsvc) if (!hsvc)
{
RegCloseKey(hKey);
return NULL; return NULL;
}
strcpyW( hsvc->name, lpServiceName ); strcpyW( hsvc->name, lpServiceName );
hsvc->hkey = hKey; hsvc->hkey = hKey;
hsvc->dwAccess = dwDesiredAccess; hsvc->dwAccess = dwDesiredAccess;