diff mbox series

[FFmpeg-devel,02/23] avutil/hwcontext: Don't check before av_buffer_unref()

Message ID DU0P250MB07476B5E65D6F6E836CC81758F482@DU0P250MB0747.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 2e4e424ac237e34fe106dca4c224a46eabefb4c9
Headers show
Series [FFmpeg-devel,01/23] avutil/hwcontext_opencl: Use proper OpenCLFramesContext | 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

Andreas Rheinhardt Feb. 12, 2024, 12:03 a.m. UTC
av_buffer_unref() can handle AVBufferRef** that point
to a NULL AVBufferRef*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavutil/hwcontext.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavutil/hwcontext.c b/libavutil/hwcontext.c
index e23bad230f..63fc1a6a22 100644
--- a/libavutil/hwcontext.c
+++ b/libavutil/hwcontext.c
@@ -297,8 +297,7 @@  AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
     return buf;
 
 fail:
-    if (device_ref)
-        av_buffer_unref(&device_ref);
+    av_buffer_unref(&device_ref);
     if (ctx->internal)
         av_freep(&ctx->internal->priv);
     av_freep(&ctx->internal);