Update status based on DXGK and HKR enumearation
authorNikhil Joshi <nikhilj@nvidia.com>
Tue, 24 Sep 2019 17:06:12 +0000 (22:36 +0530)
committerNikhil Joshi <nikhilj@nvidia.com>
Tue, 24 Sep 2019 17:13:26 +0000 (22:43 +0530)
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

index f1609e8..12c251a 100644 (file)
@@ -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)
     {