diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c index 402e3b5af3..8ed706d149 100644 --- a/libavfilter/vf_gradfun.c +++ b/libavfilter/vf_gradfun.c @@ -166,6 +166,7 @@ static int config_input(AVFilterLink *inlink) int hsub = desc->log2_chroma_w; int vsub = desc->log2_chroma_h; + av_freep(&s->buf); s->buf = av_mallocz((FFALIGN(inlink->w, 16) * (s->radius + 1) / 2 + 32) * sizeof(uint16_t)); if (!s->buf) return AVERROR(ENOMEM);