c/util: Fix leaks of image views in swapchain

This fixes a regression I introduced in !1417.
This commit is contained in:
Jakob Bornecrantz 2023-11-20 19:31:14 +00:00 committed by Simon Zeni
parent add64c1531
commit a6d840b0b1

View file

@ -250,9 +250,8 @@ set_common_fields(struct comp_swapchain *sc,
}
static void
image_view_array_cleanup(struct vk_bundle *vk, size_t *array_size_ptr, VkImageView **views_ptr)
image_view_array_cleanup(struct vk_bundle *vk, size_t array_size, VkImageView **views_ptr)
{
size_t array_size = *array_size_ptr;
VkImageView *views = *views_ptr;
if (views == NULL) {
@ -269,7 +268,6 @@ image_view_array_cleanup(struct vk_bundle *vk, size_t *array_size_ptr, VkImageVi
free(views);
*array_size_ptr = 0;
*views_ptr = NULL;
}
@ -290,8 +288,10 @@ image_cleanup(struct vk_bundle *vk, struct comp_swapchain_image *image)
vk->vkDeviceWaitIdle(vk->device);
os_mutex_unlock(&vk->queue_mutex);
image_view_array_cleanup(vk, &image->array_size, &image->views.alpha);
image_view_array_cleanup(vk, &image->array_size, &image->views.no_alpha);
// The field array_size is shared, only reset once both are freed.
image_view_array_cleanup(vk, image->array_size, &image->views.alpha);
image_view_array_cleanup(vk, image->array_size, &image->views.no_alpha);
image->array_size = 0;
}
static void