[PATCH] initialize hKeysub

Marcus Meissner marcus at jet.franken.de
Thu Feb 8 13:35:44 CST 2007


Hi,

Coverity thinks hkeySub is used uninitialized,
which is true.

The logic is kinda bad in this function.

Ciao, Marcus
---
 dlls/devenum/devenum_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/dlls/devenum/devenum_main.c b/dlls/devenum/devenum_main.c
index 66b0f0e..0dde409 100644
--- a/dlls/devenum/devenum_main.c
+++ b/dlls/devenum/devenum_main.c
@@ -311,6 +311,7 @@ static HRESULT register_clsids(int count
 
     for (i = 0; i < count; i++)
     {
+	hkeySub = 0;
         if (SUCCEEDED(res))
 	{
 	    res = StringFromCLSID(pRegInfo[i].clsid, &clsidString);
@@ -351,7 +352,7 @@ static HRESULT register_clsids(int count
 			   (lstrlenW(pszThreadingModel) + 1) * sizeof(WCHAR));
             RegCloseKey(hkeyInproc32);
         }
-        RegCloseKey(hkeySub);
+        if (hkeySub) RegCloseKey(hkeySub);
 	CoTaskMemFree(clsidString);
 	clsidString = NULL;
     }
-- 
1.4.3.4



More information about the wine-patches mailing list