[FFmpeg-devel] [PATCH] avcodec/vaapi:free slice_buffers when decoding failed
Mark Thompson
sw at jkqxz.net
Wed Sep 19 01:44:57 EEST 2018
On 14/09/18 08:25, Linjie Fu wrote:
> If vaEndPicture failed in ff_vaapi_decode_issue, free
> the pic->slice_buffer.
>
> Fix the memory leak issue in ticket #7385
>
> Signed-off-by: Linjie Fu <linjie.fu at intel.com>
> ---
> libavcodec/vaapi_decode.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c
> index d0a6b5817d..700cd5c681 100644
> --- a/libavcodec/vaapi_decode.c
> +++ b/libavcodec/vaapi_decode.c
> @@ -216,6 +216,11 @@ fail_with_picture:
> fail:
> ff_vaapi_decode_destroy_buffers(avctx, pic);
> fail_at_end:
> + pic->nb_param_buffers = 0;
> + pic->nb_slices = 0;
> + pic->slices_allocated = 0;
> + av_freep(&pic->slice_buffers);
> +
> return err;
> }
Makes sense, but would you mind uniting the two return paths rather than duplicating the code?
Thanks,
- Mark
More information about the ffmpeg-devel
mailing list