[FFmpeg-devel] [PATCH] avcodec/mpegvideo_enc: fix memory leak

Timo Rothenpieler timo at rothenpieler.org
Mon Sep 26 11:18:35 EEST 2016


> When the input frames contain side data, it will accumulate endlessly in
> the coded frame, as av_frame_copy_props will append any new side data.
> ---
>  libavcodec/mpegvideo_enc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
> index 87d7954..5cd654f 100644
> --- a/libavcodec/mpegvideo_enc.c
> +++ b/libavcodec/mpegvideo_enc.c
> @@ -1735,6 +1735,7 @@ static void frame_end(MpegEncContext *s)
>  
>  #if FF_API_CODED_FRAME
>  FF_DISABLE_DEPRECATION_WARNINGS
> +    av_frame_unref(s->avctx->coded_frame);
>      av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
>  FF_ENABLE_DEPRECATION_WARNINGS
>  #endif
> 

Will push later today, unless someone has a better idea how to address
this issue.
Maybe some way to not use av_frame_copy_props in the first place?


More information about the ffmpeg-devel mailing list