diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-02-10 09:10:35 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-02-10 09:22:36 +0100 |
commit | 9809f318ea8812f4185b35d7c5a08899f35e0db0 (patch) | |
tree | 253b917509132c05d6ad587c1c7668ab1118730f /libavfilter/vf_dblur.c | |
parent | f89cd457ca962c66b323f5a10912fc7e0ac8b3c2 (diff) | |
download | ffmpeg-9809f318ea8812f4185b35d7c5a08899f35e0db0.tar.gz |
avfilter/vf_dblur: fix memory leaks if config_input() is called again
Diffstat (limited to 'libavfilter/vf_dblur.c')
-rw-r--r-- | libavfilter/vf_dblur.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libavfilter/vf_dblur.c b/libavfilter/vf_dblur.c index e821029906..05beb249b0 100644 --- a/libavfilter/vf_dblur.c +++ b/libavfilter/vf_dblur.c @@ -134,11 +134,20 @@ static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_NONE }; +static av_cold void uninit(AVFilterContext *ctx) +{ + DBlurContext *s = ctx->priv; + + av_freep(&s->buffer); +} + static int config_input(AVFilterLink *inlink) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); DBlurContext *s = inlink->dst->priv; + uninit(inlink->dst); + s->depth = desc->comp[0].depth; s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); s->planewidth[0] = s->planewidth[3] = inlink->w; @@ -262,13 +271,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return ff_filter_frame(outlink, out); } -static av_cold void uninit(AVFilterContext *ctx) -{ - DBlurContext *s = ctx->priv; - - av_freep(&s->buffer); -} - static const AVFilterPad dblur_inputs[] = { { .name = "default", |