From 7fb7b2917ef98618aef31a611b281b66d698543f Mon Sep 17 00:00:00 2001 From: Mark Young Date: Thu, 15 Jun 2017 08:36:58 -0600 Subject: loader: Fix alloc issue We were allocating the wrong struct for the dispatch table object when creating the instance. This left us using invalid memory when using the physical device extension trampolines. Change-Id: I9939a8c9fe320b0d07592ab4beb5b6faaba40383 --- loader/trampoline.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'loader') diff --git a/loader/trampoline.c b/loader/trampoline.c index 1afe4455..b03ebda6 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -307,16 +307,16 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr goto out; } - ptr_instance->disp = - loader_instance_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + ptr_instance->disp = loader_instance_heap_alloc(ptr_instance, sizeof(struct loader_instance_dispatch_table), + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ptr_instance->disp == NULL) { loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkCreateInstance: Failed to allocate Instance dispatch" - " table."); + "vkCreateInstance: Failed to allocate Loader's full Instance dispatch table."); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp)); + memcpy(&ptr_instance->disp->layer_inst_disp, &instance_disp, sizeof(instance_disp)); + ptr_instance->next = loader.instances; loader.instances = ptr_instance; -- cgit v1.2.3