Commit 46229acd authored by Frédéric Delanoy's avatar Frédéric Delanoy Committed by Alexandre Julliard

gameux: Do not use RegCloseKey on invalid/uninitialized registry key handle (Coverity).

parent 90415ebd
...@@ -388,17 +388,18 @@ static HRESULT GAMEUX_getAppIdFromGDFPath( ...@@ -388,17 +388,18 @@ static HRESULT GAMEUX_getAppIdFromGDFPath(
/* game is registered, let's read it's application id from registry */ /* game is registered, let's read it's application id from registry */
hr = GAMEUX_buildGameRegistryPath(installScope, &instanceId, &lpRegistryPath); hr = GAMEUX_buildGameRegistryPath(installScope, &instanceId, &lpRegistryPath);
if(SUCCEEDED(hr)) if(SUCCEEDED(hr)) {
hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE, hr = HRESULT_FROM_WIN32(RegOpenKeyExW(HKEY_LOCAL_MACHINE,
lpRegistryPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey)); lpRegistryPath, 0, KEY_READ | KEY_WOW64_64KEY, &hKey));
if(SUCCEEDED(hr)) {
if(SUCCEEDED(hr)) hr = HRESULT_FROM_WIN32(RegGetValueW(hKey,
hr = HRESULT_FROM_WIN32(RegGetValueW(hKey, NULL, sApplicationId, RRF_RT_REG_SZ,
NULL, sApplicationId, RRF_RT_REG_SZ, NULL, lpApplicationId, &dwLength));
NULL, lpApplicationId, &dwLength)); RegCloseKey(hKey);
}
}
HeapFree(GetProcessHeap(), 0, lpRegistryPath); HeapFree(GetProcessHeap(), 0, lpRegistryPath);
RegCloseKey(hKey);
TRACE("found app id: %s, return: %#x\n", debugstr_w(lpApplicationId), hr); TRACE("found app id: %s, return: %#x\n", debugstr_w(lpApplicationId), hr);
return hr; return hr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment