[FFmpeg-devel] [PATCH] avfilter/drawtext: fix frame mem leak

Ivan Efimov ioefimov at gmail.com
Tue Apr 14 09:47:28 CEST 2015


2015-04-10 17:28 GMT+03:00 Ivan Efimov <ioefimov at gmail.com>:
> Signed-off-by: Ivan Efimov <ioefimov at gmail.com>
> ---
> This fixes memory leak in drawtext in case of textfile load error
>
>  libavfilter/vf_drawtext.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> index 37eb231..cf17a55 100644
> --- a/libavfilter/vf_drawtext.c
> +++ b/libavfilter/vf_drawtext.c
> @@ -1275,12 +1275,16 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
>      int ret;
>
>      if (s->reload) {
> -        if ((ret = load_textfile(ctx)) < 0)
> +        if ((ret = load_textfile(ctx)) < 0) {
> +            av_frame_free(&frame);
>              return ret;
> +        }
>  #if CONFIG_LIBFRIBIDI
>          if (s->text_shaping)
> -            if ((ret = shape_text(ctx)) < 0)
> +            if ((ret = shape_text(ctx)) < 0) {
> +                av_frame_free(&frame);
>                  return ret;
> +            }
>  #endif
>      }
>
> --
> 2.1.4
>

Hi all,

Could you please take a look at my patch for drawtext.
It is fairly small, so it should not take a lot of time.

BR,
Ivan


More information about the ffmpeg-devel mailing list