From 48128c402b023e66e0946dfe7efbf7e12ebffd5f Mon Sep 17 00:00:00 2001 From: Lenny Komow Date: Tue, 12 Sep 2017 22:54:21 -0600 Subject: [PATCH] loader: Fix crash from loading invalid ICD Addresses LunarXchange issue 711 Change-Id: Ia67441a3adde5ddf9d72ffd12c8cc5fb44071b96 --- loader/loader.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/loader/loader.c b/loader/loader.c index 2fc394c..6850153 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -4935,6 +4935,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI goto out; } + // If any error happens after here, we need to remove the ICD from the list, + // because we've already added it, but haven't validated it + icd_create_info.enabledExtensionCount = 0; struct loader_extension_list icd_exts; @@ -5001,6 +5004,9 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI loader_log(ptr_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "terminator_CreateInstance: Failed to CreateInstance and find " "entrypoints with ICD. Skipping ICD."); + ptr_instance->icd_terms = icd_term->next; + icd_term->next = NULL; + loader_icd_destroy(ptr_instance, icd_term, pAllocator); continue; } -- 2.7.4