[FFmpeg-devel] [PATCH] avfilter/formats: fix leak of formats on error

Paul B Mahol onemda at gmail.com
Wed Jan 6 16:02:20 CET 2016


On 1/5/16, Paul B Mahol <onemda at gmail.com> wrote:
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/formats.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/libavfilter/formats.c b/libavfilter/formats.c
> index a2b19e7..f12dcf4 100644
> --- a/libavfilter/formats.c
> +++ b/libavfilter/formats.c
> @@ -518,6 +518,8 @@ void ff_formats_changeref(AVFilterFormats **oldref,
> AVFilterFormats **newref)
>              int ret = ref_fn(fmts, &ctx->inputs[i]->out_fmts);      \
>              if (ret < 0) {                                          \
>                  unref_fn(&fmts);                                    \
> +                av_freep(&fmts->list);                              \
> +                av_freep(&fmts);                                    \
>                  return ret;                                         \
>              }                                                       \
>              count++;                                                \
> @@ -528,6 +530,8 @@ void ff_formats_changeref(AVFilterFormats **oldref,
> AVFilterFormats **newref)
>              int ret = ref_fn(fmts, &ctx->outputs[i]->in_fmts);      \
>              if (ret < 0) {                                          \
>                  unref_fn(&fmts);                                    \
> +                av_freep(&fmts->list);                              \
> +                av_freep(&fmts);                                    \
>                  return ret;                                         \
>              }                                                       \
>              count++;                                                \
> --
> 1.9.1
>
>

I will commit this if nobody object. As it fix memory leak.


More information about the ffmpeg-devel mailing list