[PATCH] win32u: Fix a memory leak.

Zhiyi Zhang zzhang at codeweavers.com
Tue May 17 01:19:01 CDT 2022


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 at codeweavers.com>
---
 dlls/win32u/sysparams.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c
index 5fec4ade0f8..dd494188121 100644
--- a/dlls/win32u/sysparams.c
+++ b/dlls/win32u/sysparams.c
@@ -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 );
-- 
2.34.1



More information about the wine-devel mailing list