[FFmpeg-devel] [PATCH 20/20] avfilter/af_headphone: Fix leak of channel layouts list on error

Paul B Mahol onemda at gmail.com
Wed Aug 26 23:16:19 EEST 2020


On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt at gmail.com> wrote:
> In case the multichannel HRIR mode was enabled, an error could happen
> between allocating a channel layouts list and attaching it to its target
> destination. If an error happened, the list would leak. This is fixed by
> attaching the list to its target directly after its allocation.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---


LGTM

> Forgot this one. Btw: Should one factor out common operations like
> ff_make_formats_list()+ff_formats_ref()?
>
>  libavfilter/af_headphone.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/af_headphone.c b/libavfilter/af_headphone.c
> index 751f4ab53d..da5acdce30 100644
> --- a/libavfilter/af_headphone.c
> +++ b/libavfilter/af_headphone.c
> @@ -703,6 +703,9 @@ static int query_formats(AVFilterContext *ctx)
>          return ret;
>
>      ret = ff_add_channel_layout(&stereo_layout, AV_CH_LAYOUT_STEREO);
> +    if (ret)
> +        return ret;
> +    ret = ff_channel_layouts_ref(stereo_layout,
> &ctx->outputs[0]->in_channel_layouts);
>      if (ret)
>          return ret;
>
> @@ -721,10 +724,6 @@ static int query_formats(AVFilterContext *ctx)
>          }
>      }
>
> -    ret = ff_channel_layouts_ref(stereo_layout,
> &ctx->outputs[0]->in_channel_layouts);
> -    if (ret)
> -        return ret;
> -
>      formats = ff_all_samplerates();
>      if (!formats)
>          return AVERROR(ENOMEM);
> --
> 2.20.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list