[FFmpeg-cvslog] vulkan_decode: check if yuv_sampler exists before freeing it

Lynne git at videolan.org
Mon May 29 04:26:12 EEST 2023


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Mon May 29 02:04:59 2023 +0200| [bae92361ed130aef1bada7c59eb67393510e0f1a] | committer: Lynne

vulkan_decode: check if yuv_sampler exists before freeing it

This prevents multiple NULL accesses - if yuv_sampler exists, then
everything required for it to be destroyed also exists.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bae92361ed130aef1bada7c59eb67393510e0f1a
---

 libavcodec/vulkan_decode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 1d1fb9ad97..6138106fef 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -581,8 +581,9 @@ static void free_common(void *opaque, uint8_t *data)
 
     ff_vk_video_common_uninit(s, &ctx->common);
 
-    vk->DestroySamplerYcbcrConversion(s->hwctx->act_dev, ctx->yuv_sampler,
-                                      s->hwctx->alloc);
+    if (ctx->yuv_sampler)
+        vk->DestroySamplerYcbcrConversion(s->hwctx->act_dev, ctx->yuv_sampler,
+                                          s->hwctx->alloc);
 
     ff_vk_uninit(s);
 }



More information about the ffmpeg-cvslog mailing list