avutil/hwcontext: Don't assume device_uninit is reentrant

device_uninit will be called by hwdevice_ctx_free. vulkan_device_uninit
is non-reentrant.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili 2024-02-20 20:08:54 +08:00 committed by Zhao Zhili
parent 39a0c55347
commit 90bbe1e8e2
1 changed files with 2 additions and 9 deletions

View File

@ -205,18 +205,11 @@ fail:
int av_hwdevice_ctx_init(AVBufferRef *ref)
{
AVHWDeviceContext *ctx = (AVHWDeviceContext*)ref->data;
int ret;
int ret = 0;
if (ctx->internal->hw_type->device_init) {
if (ctx->internal->hw_type->device_init)
ret = ctx->internal->hw_type->device_init(ctx);
if (ret < 0)
goto fail;
}
return 0;
fail:
if (ctx->internal->hw_type->device_uninit)
ctx->internal->hw_type->device_uninit(ctx);
return ret;
}