[FFmpeg-cvslog] avutil/hwcontext: Don't check before av_buffer_unref()

Andreas Rheinhardt git at videolan.org
Sun Feb 25 03:41:14 EET 2024


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Feb 11 19:08:44 2024 +0100| [2e4e424ac237e34fe106dca4c224a46eabefb4c9] | committer: Andreas Rheinhardt

avutil/hwcontext: Don't check before av_buffer_unref()

av_buffer_unref() can handle AVBufferRef** that point
to a NULL AVBufferRef*.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2e4e424ac237e34fe106dca4c224a46eabefb4c9
---

 libavutil/hwcontext.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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);



More information about the ffmpeg-cvslog mailing list