Zhiyi Zhang : winemac.drv: Set hkey to NULL after RegCloseKey() in macdrv_init_gpu().

Alexandre Julliard julliard at winehq.org
Tue Oct 19 16:07:47 CDT 2021


Module: wine
Branch: master
Commit: 5b7397bb27968267e22cc9393dbcaf2cacb7798a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5b7397bb27968267e22cc9393dbcaf2cacb7798a

Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date:   Tue Oct 19 10:39:26 2021 +0800

winemac.drv: Set hkey to NULL after RegCloseKey() in macdrv_init_gpu().

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>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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),




More information about the wine-cvs mailing list