diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2024-02-20 20:08:57 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2024-03-01 17:20:29 +0800 |
commit | 03275b0f093291542799ac6dbc9929dbb4d405bf (patch) | |
tree | 155678f31ed62c183df1e699aa2f68ce9e4ff162 /libavutil/hwcontext_vulkan.c | |
parent | 6f9730cb2847e157049909308a9d05384a57d926 (diff) | |
download | ffmpeg-03275b0f093291542799ac6dbc9929dbb4d405bf.tar.gz |
avutil/hwcontext_vulkan: Fix leaks in map_from_drm
Also simplify error handing.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavutil/hwcontext_vulkan.c')
-rw-r--r-- | libavutil/hwcontext_vulkan.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 747f8de3ce..818ebac2d1 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -2632,7 +2632,8 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f if (ret != VK_SUCCESS) { av_log(hwctx, AV_LOG_ERROR, "Failed to create semaphore: %s\n", ff_vk_ret2str(ret)); - return AVERROR_EXTERNAL; + err = AVERROR_EXTERNAL; + goto fail; } /* We'd import a semaphore onto the one we created using @@ -2751,14 +2752,7 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f return 0; fail: - for (int i = 0; i < desc->nb_layers; i++) { - vk->DestroyImage(hwctx->act_dev, f->img[i], hwctx->alloc); - vk->DestroySemaphore(hwctx->act_dev, f->sem[i], hwctx->alloc); - } - for (int i = 0; i < desc->nb_objects; i++) - vk->FreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); - - av_free(f); + vulkan_frame_free(hwfc, f); return err; } |