From: Mark Young Date: Thu, 15 Jun 2017 14:36:58 +0000 (-0600) Subject: loader: Fix alloc issue X-Git-Tag: sdk-1.0.54.0~101 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d660c139f540f669a964a4466f709a7cd777333e;p=platform%2Fupstream%2FVulkan-LoaderAndValidationLayers.git 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 --- diff --git a/loader/trampoline.c b/loader/trampoline.c index 1afe445..b03ebda 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;