[FFmpeg-cvslog] avcodec/vaapi: free slice_buffers when decoding failed
Linjie Fu
git at videolan.org
Sun Sep 23 19:47:08 EEST 2018
ffmpeg | branch: master | Linjie Fu <linjie.fu at intel.com> | Wed Sep 19 10:01:23 2018 +0800| [0f9b298242ca2e1e2e4414967921463566f1dded] | committer: Mark Thompson
avcodec/vaapi: free slice_buffers when decoding failed
If vaEndPicture() failed in ff_vaapi_decode_issue(), free
the pic->slice_buffers.
Fixes the memory leak issue in ticket #7385
Signed-off-by: Linjie Fu <linjie.fu at intel.com>
Signed-off-by: Mark Thompson <sw at jkqxz.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f9b298242ca2e1e2e4414967921463566f1dded
---
libavcodec/vaapi_decode.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
index ece75c0815..69512e1d45 100644
--- a/libavcodec/vaapi_decode.c
+++ b/libavcodec/vaapi_decode.c
@@ -200,12 +200,8 @@ int ff_vaapi_decode_issue(AVCodecContext *avctx,
AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS)
ff_vaapi_decode_destroy_buffers(avctx, pic);
- pic->nb_param_buffers = 0;
- pic->nb_slices = 0;
- pic->slices_allocated = 0;
- av_freep(&pic->slice_buffers);
-
- return 0;
+ err = 0;
+ goto exit;
fail_with_picture:
vas = vaEndPicture(ctx->hwctx->display, ctx->va_context);
@@ -216,6 +212,12 @@ fail_with_picture:
fail:
ff_vaapi_decode_destroy_buffers(avctx, pic);
fail_at_end:
+exit:
+ pic->nb_param_buffers = 0;
+ pic->nb_slices = 0;
+ pic->slices_allocated = 0;
+ av_freep(&pic->slice_buffers);
+
return err;
}
More information about the ffmpeg-cvslog
mailing list