From e030203d8220093617af8d4a42502891902d2ca9 Mon Sep 17 00:00:00 2001 From: Normunds Rieksts Date: Fri, 28 Nov 2025 15:06:11 +0000 Subject: [PATCH] Fix a case where OOM condition was not checked Fixes a case where backing image memory creator allocation was not checked for out of memory condition which results in failing OOM CTS tests. Change-Id: I6c203599eca5562f334d4e5e3f21c200dc667ee5 Signed-off-by: Normunds Rieksts --- wsi/display/swapchain.cpp | 4 ++++ wsi/headless/swapchain.cpp | 4 ++++ wsi/wayland/swapchain.cpp | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/wsi/display/swapchain.cpp b/wsi/display/swapchain.cpp index 161a9e7..5b5be73 100644 --- a/wsi/display/swapchain.cpp +++ b/wsi/display/swapchain.cpp @@ -202,6 +202,10 @@ VkResult swapchain::init_image_factory(const VkSwapchainCreateInfoKHR &swapchain auto backing_memory_creator = m_allocator.make_unique(m_device_data, *m_wsi_allocator, wsialloc_args); + if (backing_memory_creator == nullptr) + { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } m_image_factory.init(std::move(image_handle_creator), std::move(backing_memory_creator), true, true); return VK_SUCCESS; diff --git a/wsi/headless/swapchain.cpp b/wsi/headless/swapchain.cpp index ffe97bb..f3b78ee 100644 --- a/wsi/headless/swapchain.cpp +++ b/wsi/headless/swapchain.cpp @@ -156,6 +156,10 @@ VkResult swapchain::init_image_factory(const VkSwapchainCreateInfoKHR &swapchain auto image_handle_creator = std::get>(std::move(image_handle_creator_result)); auto backing_memory_creator = m_allocator.make_unique(m_device_data); + if (backing_memory_creator == nullptr) + { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } m_image_factory.init(std::move(image_handle_creator), std::move(backing_memory_creator), false, true); return VK_SUCCESS; diff --git a/wsi/wayland/swapchain.cpp b/wsi/wayland/swapchain.cpp index a990f64..0492053 100644 --- a/wsi/wayland/swapchain.cpp +++ b/wsi/wayland/swapchain.cpp @@ -267,6 +267,10 @@ VkResult swapchain::init_image_factory(const VkSwapchainCreateInfoKHR &swapchain auto backing_memory_creator = m_allocator.make_unique(m_device_data, *m_wsi_allocator, wsialloc_args); + if (backing_memory_creator == nullptr) + { + return VK_ERROR_OUT_OF_HOST_MEMORY; + } m_image_factory.init(std::move(image_handle_creator), std::move(backing_memory_creator), true, false); return VK_SUCCESS;