win32u: Fix a memory leak.

The subkey handle is leaked when deleting a GPU entry succeeded. Also, there is no need
to restart the enumeration for the grandparent key hkey.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2022-05-17 14:19:01 +08:00 committed by Alexandre Julliard
parent 182feddd4b
commit e55515bf5b
1 changed files with 1 additions and 2 deletions

View File

@ -702,7 +702,6 @@ static void cleanup_devices(void)
hkey = reg_open_key( enum_key, pciW, sizeof(pciW) );
restart:
while (!NtEnumerateKey( hkey, i++, KeyNodeInformation, key, sizeof(buffer), &size ))
{
unsigned int j = 0;
@ -735,7 +734,7 @@ restart:
NtClose( device_key );
if (!present && reg_delete_tree( subkey, bufferW, lstrlenW( bufferW ) * sizeof(WCHAR) ))
goto restart;
j = 0;
}
NtClose( subkey );