aboutsummaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-11-30 18:00:53 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-12-02 15:14:27 +0000
commitb4ad4671dc9a2136bebff279c4b15879dad9b795 (patch)
treedb65a1735975782237d710fe9bd6919dbab13136 /render
parentbc7f8de842a9525e1be4d0e1716282a956943739 (diff)
render/vulkan: check for barrier array alloc failure
Diffstat (limited to 'render')
-rw-r--r--render/vulkan/renderer.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c
index b6cbdbc7..cbd7606c 100644
--- a/render/vulkan/renderer.c
+++ b/render/vulkan/renderer.c
@@ -833,8 +833,14 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) {
// insert acquire and release barriers for dmabuf-images
unsigned barrier_count = wl_list_length(&renderer->foreign_textures) + 1;
- VkImageMemoryBarrier* acquire_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
- VkImageMemoryBarrier* release_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier));
+ VkImageMemoryBarrier *acquire_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;
unsigned idx = 0;