Fix layer's memory errors

Fixes the wrong allocation of extensions properties.

Adds a call to the dispacher's DestroyInstance function before the
destruction of the instance.

Change-Id: I169bb3ba670d89e30af1f6ce47c536477978c169
Signed-off-by: Iason Paraskevopoulos <iason.paraskevopoulos@arm.com>
This commit is contained in:
Iason Paraskevopoulos 2020-11-17 09:27:44 +00:00
parent f782eab921
commit e5f77f7347
2 changed files with 8 additions and 3 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2019 Arm Limited.
* Copyright (c) 2016-2020 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@ -59,7 +59,7 @@ VKAPI_ATTR VkResult extension_properties(const uint32_t count, const VkExtension
}
size = *pCount < count ? *pCount : count;
memcpy(pProp, layer_ext, size * sizeof(VkLayerProperties));
memcpy(pProp, layer_ext, size * sizeof(VkExtensionProperties));
*pCount = size;
if (size < count)
{
@ -195,6 +195,10 @@ extern "C"
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL
wsi_layer_vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator)
{
assert(instance);
layer::instance_private_data::get(layer::get_key(instance))
.disp.DestroyInstance(instance, pAllocator);
layer::instance_private_data::destroy(instance);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2019 Arm Limited.
* Copyright (c) 2018-2020 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@ -37,6 +37,7 @@
V(GetPhysicalDeviceSurfaceCapabilitiesKHR) \
V(GetPhysicalDeviceSurfaceFormatsKHR) \
V(GetPhysicalDeviceSurfacePresentModesKHR) \
V(DestroyInstance) \
V(GetPhysicalDeviceSurfaceSupportKHR)
namespace layer