[FFmpeg-cvslog] avfilter/vf_gblur: fix memory leaks if config_input() is called again
Paul B Mahol
git at videolan.org
Thu Feb 10 10:22:57 EET 2022
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Feb 10 09:06:22 2022 +0100| [f89cd457ca962c66b323f5a10912fc7e0ac8b3c2] | committer: Paul B Mahol
avfilter/vf_gblur: fix memory leaks if config_input() is called again
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f89cd457ca962c66b323f5a10912fc7e0ac8b3c2
---
libavfilter/vf_gblur.c | 18 ++++++++++--------
1 file 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",
More information about the ffmpeg-cvslog
mailing list