[FFmpeg-devel] [PATCH 1/2] vf_drawtext: fix memory leaks.

Stefano Sabatini stefasab at gmail.com
Sat Apr 7 17:10:06 CEST 2012


On date Saturday 2012-04-07 16:46:48 +0200, Nicolas George encoded:
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavfilter/vf_drawtext.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
> index 1d9a858..43b04e0 100644
> --- a/libavfilter/vf_drawtext.c
> +++ b/libavfilter/vf_drawtext.c
> @@ -416,6 +416,10 @@ static int query_formats(AVFilterContext *ctx)
>  
>  static int glyph_enu_free(void *opaque, void *elem)
>  {
> +    Glyph *glyph = elem;
> +
> +    FT_Done_Glyph(*glyph->glyph);
> +    av_freep(&glyph->glyph);
>      av_free(elem);
>      return 0;
>  }
> @@ -426,6 +430,7 @@ static av_cold void uninit(AVFilterContext *ctx)
>  
>      av_expr_free(dtext->x_pexpr); dtext->x_pexpr = NULL;
>      av_expr_free(dtext->y_pexpr); dtext->y_pexpr = NULL;
> +    av_expr_free(dtext->d_pexpr); dtext->d_pexpr = NULL;
>  
>      av_freep(&dtext->boxcolor_string);
>      av_freep(&dtext->expanded_text);
> @@ -435,6 +440,7 @@ static av_cold void uninit(AVFilterContext *ctx)
>      av_freep(&dtext->text);
>      av_freep(&dtext->x_expr);
>      av_freep(&dtext->y_expr);
> +    av_freep(&dtext->d_expr);
>  
>      av_freep(&dtext->positions);
>      dtext->nb_positions = 0;

Looks fine, maybe split it in two parts since the issues are not
related.
-- 
FFmpeg = Frightening Formidable Minimal Philosophical Empowered Guru


More information about the ffmpeg-devel mailing list