aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Ashburn <jon@lunarg.com>2016-01-14 13:51:55 -0700
committerJon Ashburn <jon@lunarg.com>2016-01-14 13:54:10 -0700
commitd7700a7af813af60e1dd6dcdaebad9b37c7ef771 (patch)
treea994882d48905747a59dda3271e3feb4313746a2
parentafbb7289d5995e3a592e292e9b3895584aa4c893 (diff)
downloadusermoji-d7700a7af813af60e1dd6dcdaebad9b37c7ef771.tar.xz
loader: Fix bad memory ref and CreateInstance fail don't write ouptut
Gitlab #58 CreateInstance shouldn't update output parameter on failure.
-rw-r--r--loader/loader.c1
-rw-r--r--loader/trampoline.c21
2 files changed, 11 insertions, 11 deletions
diff --git a/loader/loader.c b/loader/loader.c
index e0760bf6..aeb83a98 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -3214,7 +3214,6 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateInstance(
{
ptr_instance->icds = ptr_instance->icds->next;
loader_icd_destroy(ptr_instance, icd);
- icd->instance = VK_NULL_HANDLE;
loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"ICD ignored: failed to CreateInstance and find entrypoints with ICD");
}
diff --git a/loader/trampoline.c b/loader/trampoline.c
index c06e2cf5..f46d40f7 100644
--- a/loader/trampoline.c
+++ b/loader/trampoline.c
@@ -181,17 +181,18 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
debug_report_create_instance(ptr_instance, pCreateInfo);
- *pInstance = (VkInstance) ptr_instance;
+ res = ptr_instance->disp->CreateInstance(pCreateInfo, pAllocator, &ptr_instance);
- res = ptr_instance->disp->CreateInstance(pCreateInfo, pAllocator, pInstance);
-
- /*
- * Finally have the layers in place and everyone has seen
- * the CreateInstance command go by. This allows the layer's
- * GetInstanceProcAddr functions to return valid extension functions
- * if enabled.
- */
- loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
+ if (res == VK_SUCCESS) {
+ *pInstance = (VkInstance) ptr_instance;
+ /*
+ * Finally have the layers in place and everyone has seen
+ * the CreateInstance command go by. This allows the layer's
+ * GetInstanceProcAddr functions to return valid extension functions
+ * if enabled.
+ */
+ loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
+ }
/* Remove temporary debug_report callback */
util_DestroyDebugReportCallback(ptr_instance, instance_callback, pAllocator);