diff mbox series

[FFmpeg-devel,1/5] avutil/hwcontext: Don't assume device_uninit is reentrant

Message ID tencent_22559F12AB0B4EC9707D2DF29AC040DE9A08@qq.com
State Accepted
Commit 90bbe1e8e2d3d832a80768a6820f995153951a81
Headers show
Series [FFmpeg-devel,1/5] avutil/hwcontext: Don't assume device_uninit is reentrant | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Feb. 20, 2024, 12:08 p.m. UTC
device_uninit will be called by hwdevice_ctx_free. vulkan_device_uninit
is non-reentrant.
---
 libavutil/hwcontext.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index e23bad230f..e8c6256a73 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;
 }