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",