From 90bbe1e8e2d3d832a80768a6820f995153951a81 Mon Sep 17 00:00:00 2001 From: Zhao Zhili Date: Tue, 20 Feb 2024 20:08:54 +0800 Subject: [PATCH] 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 --- libavutil/hwcontext.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c index 63fc1a6a22..1d2c2d7920 100644 --- a/libavutil/hwcontext.c +++ b/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; }