diff mbox series

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

Message ID AM7PR03MB66606400288235600BA4C1E98FA69@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit bd5ec3601f03c8fb5514673e862223defa6f7673
Headers show
Series [FFmpeg-devel,1/6] avcodec/qsvenc: Fix leak and crash when encoding H.264 due to A53_CC | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 26, 2021, 6:40 a.m. UTC
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@outlook.com>
---
 libavutil/hwcontext_qsv.c | 2 --
 1 file changed, 2 deletions(-)
diff mbox series

Patch

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