[FFmpeg-devel] [PATCH 5/6] avutil/hwcontext_qsv: Fix leak of AVBuffer and AVBufferRef

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Sun Sep 26 09:40:26 EEST 2021


This av_buffer_create() does nothing but leak an AVBuffer and an
AVBufferRef (except on allocation error).

Fixes Coverity issue 1491393.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
 libavutil/hwcontext_qsv.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c
index c18747f7eb..4ed50a31a0 100644
--- a/libavutil/hwcontext_qsv.c
+++ b/libavutil/hwcontext_qsv.c
@@ -235,8 +235,6 @@ static AVBufferRef *qsv_pool_alloc(void *opaque, size_t size)
 
     if (s->nb_surfaces_used < hwctx->nb_surfaces) {
         s->nb_surfaces_used++;
-        av_buffer_create((uint8_t*)(s->handle_pairs_internal + s->nb_surfaces_used - 1),
-                                sizeof(*s->handle_pairs_internal), qsv_pool_release_dummy, NULL, 0);
         return av_buffer_create((uint8_t*)(s->surfaces_internal + s->nb_surfaces_used - 1),
                                 sizeof(*hwctx->surfaces), qsv_pool_release_dummy, NULL, 0);
     }
-- 
2.30.2



More information about the ffmpeg-devel mailing list