diff options
author | Zhao Zhili <quinkblack@foxmail.com> | 2024-02-20 20:08:54 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2024-03-01 17:19:52 +0800 |
commit | 90bbe1e8e2d3d832a80768a6820f995153951a81 (patch) | |
tree | 9632a2ab0d82b1d956730b58db0e535eb9cc6196 | |
parent | 39a0c55347075120c3b4749d6ca620e248cf52bc (diff) | |
download | ffmpeg-90bbe1e8e2d3d832a80768a6820f995153951a81.tar.gz |
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>
-rw-r--r-- | libavutil/hwcontext.c | 11 |
1 files 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; } |