From af33a37eb49b66d5ce239e1c7171a4f786c24436 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Mon, 21 Aug 2017 09:07:41 +0000 Subject: [PATCH] [SHELL32] -CFSFolder: Fix a couple of handle leaks. svn path=/trunk/; revision=75633 --- reactos/dll/win32/shell32/folders/CFSFolder.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/shell32/folders/CFSFolder.cpp b/reactos/dll/win32/shell32/folders/CFSFolder.cpp index f66e25da63e..5310622523f 100644 --- a/reactos/dll/win32/shell32/folders/CFSFolder.cpp +++ b/reactos/dll/win32/shell32/folders/CFSFolder.cpp @@ -85,7 +85,9 @@ HRESULT GetCLSIDForFileType(PCUIDLIST_RELATIVE pidl, LPCWSTR KeyName, CLSID* pcl WCHAR wszCLSIDValue[CHARS_IN_GUID]; DWORD dwSize = sizeof(wszCLSIDValue); - if (RegGetValueW(hkeyProgId, NULL, NULL, RRF_RT_REG_SZ, NULL, wszCLSIDValue, &dwSize)) + LONG res = RegGetValueW(hkeyProgId, NULL, NULL, RRF_RT_REG_SZ, NULL, wszCLSIDValue, &dwSize); + RegCloseKey(hkeyProgId); + if (res) { ERR("OpenKeyFromFileType succeeded but RegGetValueW failed\n"); return S_FALSE; @@ -254,6 +256,9 @@ HRESULT CFSExtractIcon_CreateInstance(IShellFolder * psf, LPCITEMIDLIST pidl, RE { initIcon->SetNormalIcon(swShell32Name, 0); } + + if (hkey) + RegCloseKey(hkey); } return initIcon->QueryInterface(iid, ppvOut); -- 2.17.1