From e8b332d24cf2daa906af84f3f01b3304c582e78c Mon Sep 17 00:00:00 2001 From: Nikhil Joshi Date: Tue, 24 Sep 2019 22:36:12 +0530 Subject: [PATCH] Update status based on DXGK and HKR enumearation khrIcdOsVendorsEnumerate currently does not consider the status returned by DXGK and HKR enumeration and returns TRUE only if HKLM regkey enumeration results in successful adapterAdd. Fix the returned status to consider successful adapterAdd from DXGK and HKR enumeration. Also, set freed adapger pointers to NULL to avoid potential double-free issue. --- loader/windows/icd_windows.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/loader/windows/icd_windows.c b/loader/windows/icd_windows.c index f1609e8..12c251a 100644 --- a/loader/windows/icd_windows.c +++ b/loader/windows/icd_windows.c @@ -112,10 +112,12 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO khrIcdVendorsEnumerateEnv(); - if (!khrIcdOsVendorsEnumerateDXGK()) + status |= khrIcdOsVendorsEnumerateDXGK(); + if (!status) { KHR_ICD_TRACE("Failed to load via DXGK interface on RS4, continuing\n"); - if (!khrIcdOsVendorsEnumerateHKR()) + status |= khrIcdOsVendorsEnumerateHKR(); + if (!status) { KHR_ICD_TRACE("Failed to enumerate HKR entries, continuing\n"); } @@ -222,8 +224,11 @@ BOOL CALLBACK khrIcdOsVendorsEnumerate(PINIT_ONCE InitOnce, PVOID Parameter, PVO adapterFree(iterAdapter); } - free(pWinAdapterBegin); - + free(pWinAdapterBegin); + pWinAdapterBegin = NULL; + pWinAdapterEnd = NULL; + pWinAdapterCapacity = NULL; + result = RegCloseKey(platformsKey); if (ERROR_SUCCESS != result) { -- 2.7.4