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>
release/7.0
Zhao Zhili 11 months ago committed by Zhao Zhili
parent 39a0c55347
commit 90bbe1e8e2
  1. 11
      libavutil/hwcontext.c

@ -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;
}

Loading…
Cancel
Save