render/vulkan: check for barrier array alloc failure

This commit is contained in:
Simon Ser 2022-11-30 18:00:53 +01:00 committed by Simon Zeni
parent bc7f8de842
commit b4ad4671dc

View file

@ -835,6 +835,12 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
unsigned barrier_count = wl_list_length(&renderer->foreign_textures) + 1; unsigned barrier_count = wl_list_length(&renderer->foreign_textures) + 1;
VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier)); VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier)); VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
if (acquire_barriers == NULL || release_barriers == NULL) {
wlr_log_errno(WLR_ERROR, "Allocation failed");
free(acquire_barriers);
free(release_barriers);
return;
}
struct wlr_vk_texture *texture, *tmp_tex; struct wlr_vk_texture *texture, *tmp_tex;
unsigned idx = 0; unsigned idx = 0;