[FFmpeg-devel] [PATCH]Clean up if filter initialisation failed

Nicolas George george at nsup.org
Sat Aug 30 09:49:02 CEST 2014


Le tridi 13 fructidor, an CCXXII, Carl Eugen Hoyos a écrit :
> Attached patch fixes a memleak with ffmpeg if the filter initialisation fails, 
> fixes ticket #3858 for me.
> 
> Please review, Carl Eugen

> diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c
> index b6dc42f..7acff28 100644
> --- a/ffmpeg_filter.c
> +++ b/ffmpeg_filter.c
> @@ -898,8 +898,11 @@ int configure_filtergraph(FilterGraph *fg)
>          init_input_filter(fg, cur);
>  
>      for (cur = inputs, i = 0; cur; cur = cur->next, i++)
> -        if ((ret = configure_input_filter(fg, fg->inputs[i], cur)) < 0)
> +        if ((ret = configure_input_filter(fg, fg->inputs[i], cur)) < 0) {
> +            avfilter_inout_free(&inputs);
> +            avfilter_inout_free(&outputs);
>              return ret;
> +        }
>      avfilter_inout_free(&inputs);
>  
>      if (!init || simple) {

Looks right.

Please mention in the commit short message that it is about the command-line
tools and not the library; maybe "ffmpeg: clean up if...".

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140830/2366e7a8/attachment.asc>


More information about the ffmpeg-devel mailing list