diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2024-01-17 01:52:05 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-01-17 15:44:37 +0000 |
commit | 3eb89e53252d3d4ce164f3a9abb99231f280240d (patch) | |
tree | 106ab833ba42a3393e5cd678d7fed258768d9bf3 | |
parent | 7129eaa1f24a1287a5a071b6718a859b32000f85 (diff) |
render/vulkan: fix possible double free
-rw-r--r-- | render/vulkan/pass.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/render/vulkan/pass.c b/render/vulkan/pass.c index 42bd6b4e..e981a3e1 100644 --- a/render/vulkan/pass.c +++ b/render/vulkan/pass.c @@ -124,14 +124,18 @@ static bool render_pass_submit(struct wlr_render_pass *wlr_pass) { // insert acquire and release barriers for dmabuf-images uint32_t barrier_count = wl_list_length(&renderer->foreign_textures) + 1; + render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(*render_wait)); + if (render_wait == NULL) { + wlr_log_errno(WLR_ERROR, "Allocation failed"); + goto error; + } + VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(*acquire_barriers)); VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(*release_barriers)); - render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(*render_wait)); - if (acquire_barriers == NULL || release_barriers == NULL || render_wait == NULL) { + if (acquire_barriers == NULL || release_barriers == NULL) { wlr_log_errno(WLR_ERROR, "Allocation failed"); free(acquire_barriers); free(release_barriers); - free(render_wait); goto error; } |