lavc/vulkan_video: fix double-free if ff_vk_decode_init() fails

ff_vk_video_common_init() calls ff_vk_video_common_uninit() on failure
which leaves dangling object handles. Those get freed again when the
destructor of FFVulkanDecodeShared calls ff_vk_video_common_uninit()
again.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
This commit is contained in:
Cameron Gutman 2025-12-11 17:39:16 -06:00 committed by Lynne
parent a72e01b4ec
commit 4e4677bf58

View file

@ -349,17 +349,21 @@ av_cold void ff_vk_video_common_uninit(FFVulkanContext *s,
av_freep(&common->mem);
if (common->layered_view)
if (common->layered_view) {
vk->DestroyImageView(s->hwctx->act_dev, common->layered_view,
s->hwctx->alloc);
common->layered_view = VK_NULL_HANDLE;
}
av_frame_free(&common->layered_frame);
av_buffer_unref(&common->dpb_hwfc_ref);
if (common->yuv_sampler)
if (common->yuv_sampler) {
vk->DestroySamplerYcbcrConversion(s->hwctx->act_dev, common->yuv_sampler,
s->hwctx->alloc);
common->yuv_sampler = VK_NULL_HANDLE;
}
}
av_cold int ff_vk_video_common_init(AVCodecContext *avctx, FFVulkanContext *s,