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

View file

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