[FFmpeg-devel] [PATCH 15/19] avfilter/vf_signature: Fix leak of inpads' names

Paul B Mahol onemda at gmail.com
Wed Aug 26 23:25:14 EEST 2020


On 8/25/20, Andreas Rheinhardt <andreas.rheinhardt at gmail.com> wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> It is not intended for these added lines to live very long: One can add
> flags to AVFilter.flags_internal that indicate that this filter wants
> the inpads/outpads' names be freed generically. This will allow to
> remove most of the code for freeing in/outpads. These flags can also be
> used to make ff_insert_in/outpad free the name itself upon error.
>
> Furthermore, one can make ff_insert_pad() return AVERROR(ENOMEM) if the
> name of the pad that is about to be inserted is NULL; this allows to
> remove the checks for allocation failure from the callers.
>
>  libavfilter/vf_signature.c | 2 ++
>  1 file changed, 2 insertions(+)
>

LGTM

> diff --git a/libavfilter/vf_signature.c b/libavfilter/vf_signature.c
> index 5ea55d5247..d09003746c 100644
> --- a/libavfilter/vf_signature.c
> +++ b/libavfilter/vf_signature.c
> @@ -730,6 +730,8 @@ static av_cold void uninit(AVFilterContext *ctx)
>          }
>          av_freep(&sic->streamcontexts);
>      }
> +    for (unsigned i = 0; i < ctx->nb_inputs; i++)
> +        av_freep(&ctx->input_pads[i].name);
>  }
>
>  static int config_output(AVFilterLink *outlink)
> --
> 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