[FFmpeg-cvslog] avfilter/vf_avgblur: fix memory leaks if config_input() is called again
Paul B Mahol
git at videolan.org
Thu Feb 10 10:23:05 EET 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Feb 10 09:18:36 2022 +0100| [9bdb476c40372a2609219e649dcc037ee7c67963] | committer: Paul B Mahol
avfilter/vf_avgblur: fix memory leaks if config_input() is called again
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bdb476c40372a2609219e649dcc037ee7c67963
---
libavfilter/vf_avgblur.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/libavfilter/vf_avgblur.c b/libavfilter/vf_avgblur.c
index e44b9f63c8..bd4471cb8e 100644
--- a/libavfilter/vf_avgblur.c
+++ b/libavfilter/vf_avgblur.c
@@ -187,12 +187,21 @@ static void build_lut(AVFilterContext *ctx, int max)
}
}
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ AverageBlurContext *s = ctx->priv;
+
+ av_freep(&s->buffer);
+}
+
static int config_input(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
AverageBlurContext *s = ctx->priv;
+ uninit(ctx);
+
s->depth = desc->comp[0].depth;
s->max = 1 << s->depth;
s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
@@ -316,13 +325,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
return 0;
}
-static av_cold void uninit(AVFilterContext *ctx)
-{
- AverageBlurContext *s = ctx->priv;
-
- av_freep(&s->buffer);
-}
-
static const AVFilterPad avgblur_inputs[] = {
{
.name = "default",
More information about the ffmpeg-cvslog
mailing list