summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiyu Yang <jiyu.yang@nxp.com>2023-10-30 15:24:42 +0800
committerDennis Tsiang <dennis.tsiang@arm.com>2023-10-31 08:54:05 +0000
commit5f1733d88bda28d66c99753fc6bb9093b99aef78 (patch)
tree85051e14d5623bd6aea1c4a6cd38c9eb554be31d
parentb1621015c71a4450deb4a9d1bdf24c7649253ad9 (diff)
downloadvulkan-wsi-layer-5f1733d88bda28d66c99753fc6bb9093b99aef78.tar.gz
vulkan-wsi-layer-5f1733d88bda28d66c99753fc6bb9093b99aef78.tar.bz2
vulkan-wsi-layer-5f1733d88bda28d66c99753fc6bb9093b99aef78.zip
fix Use after free
Signed-off-by: Jiyu Yang <jiyu.yang@nxp.com>
-rw-r--r--layer/swapchain_api.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/layer/swapchain_api.cpp b/layer/swapchain_api.cpp
index e96ba71..9084dd3 100644
--- a/layer/swapchain_api.cpp
+++ b/layer/swapchain_api.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2019, 2021-2022 Arm Limited.
+ * Copyright (c) 2017, 2019, 2021-2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -82,10 +82,10 @@ wsi_layer_vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapc,
}
assert(swapc != VK_NULL_HANDLE);
+ device_data.remove_layer_swapchain(swapc);
+
auto *sc = reinterpret_cast<wsi::swapchain_base *>(swapc);
wsi::destroy_surface_swapchain(sc, device_data, pAllocator);
-
- device_data.remove_layer_swapchain(swapc);
}
VWL_VKAPI_CALL(VkResult)