From eb2c5f864c4548613b298fb1813e92effb89429d Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Sat, 18 Oct 2008 21:38:25 +0000 Subject: [PATCH] Initialize variables and close keys only if they were opened, based on wine code. Fixes CIDs 787, 788. svn path=/trunk/; revision=36815 --- reactos/dll/directx/devenum/devenum_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/reactos/dll/directx/devenum/devenum_main.c b/reactos/dll/directx/devenum/devenum_main.c index ffdb9f20e34..1f65126748c 100644 --- a/reactos/dll/directx/devenum/devenum_main.c +++ b/reactos/dll/directx/devenum/devenum_main.c @@ -299,7 +299,7 @@ static HRESULT register_clsids(int count, const register_info * pRegInfo, LPCWST { HRESULT res = S_OK; WCHAR dll_module[MAX_PATH]; - LPOLESTR clsidString; + LPOLESTR clsidString = NULL; HKEY hkeyClsid; HKEY hkeySub; HKEY hkeyInproc32; @@ -321,6 +321,7 @@ static HRESULT register_clsids(int count, const register_info * pRegInfo, LPCWST for (i = 0; i < count; i++) { + hkeySub = 0; if (SUCCEEDED(res)) { res = StringFromCLSID(pRegInfo[i].clsid, &clsidString); @@ -361,7 +362,7 @@ static HRESULT register_clsids(int count, const register_info * pRegInfo, LPCWST (lstrlenW(pszThreadingModel) + 1) * sizeof(WCHAR)); RegCloseKey(hkeyInproc32); } - RegCloseKey(hkeySub); + if (hkeySub) RegCloseKey(hkeySub); CoTaskMemFree(clsidString); clsidString = NULL; }