The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

c/util: Fix leaks of image views in swapchain

This fixes a regression I introduced in !1417.

authored by

Jakob Bornecrantz and committed by
Simon Zeni
a6d840b0 add64c15

+5 -5
+5 -5
src/xrt/compositor/util/comp_swapchain.c
··· 250 250 } 251 251 252 252 static void 253 - image_view_array_cleanup(struct vk_bundle *vk, size_t *array_size_ptr, VkImageView **views_ptr) 253 + image_view_array_cleanup(struct vk_bundle *vk, size_t array_size, VkImageView **views_ptr) 254 254 { 255 - size_t array_size = *array_size_ptr; 256 255 VkImageView *views = *views_ptr; 257 256 258 257 if (views == NULL) { ··· 269 268 270 269 free(views); 271 270 272 - *array_size_ptr = 0; 273 271 *views_ptr = NULL; 274 272 } 275 273 ··· 290 288 vk->vkDeviceWaitIdle(vk->device); 291 289 os_mutex_unlock(&vk->queue_mutex); 292 290 293 - image_view_array_cleanup(vk, &image->array_size, &image->views.alpha); 294 - image_view_array_cleanup(vk, &image->array_size, &image->views.no_alpha); 291 + // The field array_size is shared, only reset once both are freed. 292 + image_view_array_cleanup(vk, image->array_size, &image->views.alpha); 293 + image_view_array_cleanup(vk, image->array_size, &image->views.no_alpha); 294 + image->array_size = 0; 295 295 } 296 296 297 297 static void