advapi/service: Fix possible handle leak.
This commit is contained in:
parent
05fec6c871
commit
13b3b724c6
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue