Zhiyi Zhang : win32u: Fix a memory leak.

Alexandre Julliard julliard at winehq.org
Tue May 17 15:37:23 CDT 2022


Module: wine
Branch: master
Commit: e55515bf5b21580499ee05bee964444be8dc3c3a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e55515bf5b21580499ee05bee964444be8dc3c3a

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue May 17 14:19:01 2022 +0800

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 at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 );




More information about the wine-cvs mailing list