1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-03-23 04:24:35 +02:00

avutil/hwcontext: Don't assume frames_uninit is reentrant

Fix heap use after free when vulkan_frames_init failed.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
(cherry picked from commit 3bb00c0a420c3ce83c6fafee30270d69622ccad7)
This commit is contained in:
Zhao Zhili 2024-02-20 20:08:55 +08:00
parent 4d40898657
commit 7d79d0a43b

View File

@ -363,7 +363,7 @@ int av_hwframe_ctx_init(AVBufferRef *ref)
if (ctx->internal->hw_type->frames_init) {
ret = ctx->internal->hw_type->frames_init(ctx);
if (ret < 0)
goto fail;
return ret;
}
if (ctx->internal->pool_internal && !ctx->pool)
@ -373,14 +373,10 @@ int av_hwframe_ctx_init(AVBufferRef *ref)
if (ctx->initial_pool_size > 0) {
ret = hwframe_pool_prealloc(ref);
if (ret < 0)
goto fail;
return ret;
}
return 0;
fail:
if (ctx->internal->hw_type->frames_uninit)
ctx->internal->hw_type->frames_uninit(ctx);
return ret;
}
int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ref,