diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-02-10 09:06:22 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-02-10 09:22:36 +0100 |
commit | f89cd457ca962c66b323f5a10912fc7e0ac8b3c2 (patch) | |
tree | 46aea9444db13df18f3e98dd017dfd66e4f8ca8e | |
parent | a0ede3cb564cf1cb10c8cee0b39c24a8dde15725 (diff) |
avfilter/vf_gblur: fix memory leaks if config_input() is called again
-rw-r--r-- | libavfilter/vf_gblur.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libavfilter/vf_gblur.c b/libavfilter/vf_gblur.c index a775f8cbf8..fd664db057 100644 --- a/libavfilter/vf_gblur.c +++ b/libavfilter/vf_gblur.c @@ -249,11 +249,21 @@ void ff_gblur_init(GBlurContext *s) ff_gblur_init_x86(s); } +static av_cold void uninit(AVFilterContext *ctx) +{ + GBlurContext *s = ctx->priv; + + av_freep(&s->buffer); + av_freep(&s->localbuf); +} + static int config_input(AVFilterLink *inlink) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); GBlurContext *s = inlink->dst->priv; + uninit(inlink->dst); + s->depth = desc->comp[0].depth; s->flt = !!(desc->flags & AV_PIX_FMT_FLAG_FLOAT); s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w); @@ -379,14 +389,6 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) return ff_filter_frame(outlink, out); } -static av_cold void uninit(AVFilterContext *ctx) -{ - GBlurContext *s = ctx->priv; - - av_freep(&s->buffer); - av_freep(&s->localbuf); -} - static const AVFilterPad gblur_inputs[] = { { .name = "default", |