[devenum] Don't leak key handle creating a category registry key

Thomas Weidenmueller wine-patches at reactsoft.com
Mon Dec 5 08:21:22 CST 2005


Fixed a registry key handle leak that is caused by calling RegCreateKey
twice.

- Thomas
-------------- next part --------------
Index: dlls/devenum/createdevenum.c
===================================================================
RCS file: /home/wine/wine/dlls/devenum/createdevenum.c,v
retrieving revision 1.12
diff -u -r1.12 createdevenum.c
--- dlls/devenum/createdevenum.c	30 May 2005 10:01:11 -0000	1.12
+++ dlls/devenum/createdevenum.c	5 Dec 2005 14:13:46 -0000
@@ -202,8 +202,10 @@
         res = E_INVALIDARG;
 
     if (SUCCEEDED(res))
-        res = HRESULT_FROM_WIN32(
-            RegCreateKeyW(HKEY_CURRENT_USER, wszRegKey, &hkeyDummy));
+    {
+        LONG lRes = RegCreateKeyW(HKEY_CURRENT_USER, wszRegKey, &hkeyDummy);
+        res = HRESULT_FROM_WIN32(lRes);
+    }
 
     if (hkeyDummy)
         RegCloseKey(hkeyDummy);


More information about the wine-patches mailing list