[PATCH 3/3] winemac.drv: Set hkey to NULL after RegCloseKey() in macdrv_init_gpu().

Zhiyi Zhang zzhang at codeweavers.com
Mon Oct 18 21:39:26 CDT 2021


Although it's unlikely, RegCloseKey() may close an already closed key if
the following SetupDiGetDeviceRegistryPropertyW() failed.

Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
---
 dlls/winemac.drv/display.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/winemac.drv/display.c b/dlls/winemac.drv/display.c
index b32c553d411..4a3b1ff39cb 100644
--- a/dlls/winemac.drv/display.c
+++ b/dlls/winemac.drv/display.c
@@ -1601,6 +1601,7 @@ static BOOL macdrv_init_gpu(HDEVINFO devinfo, const struct macdrv_gpu *gpu, int
     if (RegSetValueExW(hkey, dac_typeW, 0, REG_BINARY, (const BYTE *)ramdacW, sizeof(ramdacW)))
         goto done;
     RegCloseKey(hkey);
+    hkey = NULL;
 
     /* Retrieve driver value for adapters */
     if (!SetupDiGetDeviceRegistryPropertyW(devinfo, &device_data, SPDRP_DRIVER, NULL, (BYTE *)bufferW, sizeof(bufferW),
-- 
2.32.0



More information about the wine-devel mailing list