From b06848f4deccb998f019eadc9a72e595bb5db4a9 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 18 Mar 2013 21:31:54 +0100 Subject: [PATCH 1/3] vf_lut: make config_props work properly when called multiple times. Do not leak the expressions. --- libavfilter/vf_lut.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavfilter/vf_lut.c b/libavfilter/vf_lut.c index 263bd537d2..348ef32326 100644 --- a/libavfilter/vf_lut.c +++ b/libavfilter/vf_lut.c @@ -245,6 +245,8 @@ static int config_props(AVFilterLink *inlink) double res; /* create the parsed expression */ + av_expr_free(s->comp_expr[comp]); + s->comp_expr[comp] = NULL; ret = av_expr_parse(&s->comp_expr[comp], s->comp_expr_str[comp], var_names, funcs1_names, funcs1, NULL, NULL, 0, ctx); if (ret < 0) { From 87c31cfd7a2cd7893c589b4f25d6d45b196e20c1 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 18 Mar 2013 21:31:54 +0100 Subject: [PATCH 2/3] vf_gradfun: make config_props work properly when called multiple times. --- libavfilter/vf_gradfun.c | 1 + 1 file changed, 1 insertion(+) 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); From d371c3c2e2830d9783465ecfe1ab7d93351083b7 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 18 Mar 2013 21:31:54 +0100 Subject: [PATCH 3/3] vf_frei0r: make config_props work properly when called multiple times. Do not leak the initialized filter instance. --- libavfilter/vf_frei0r.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c index ff7e308a8d..7e79b28f8f 100644 --- a/libavfilter/vf_frei0r.c +++ b/libavfilter/vf_frei0r.c @@ -317,6 +317,8 @@ static int config_input_props(AVFilterLink *inlink) AVFilterContext *ctx = inlink->dst; Frei0rContext *s = ctx->priv; + if (s->destruct && s->instance) + s->destruct(s->instance); if (!(s->instance = s->construct(inlink->w, inlink->h))) { av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance"); return AVERROR(EINVAL); @@ -451,6 +453,8 @@ static int source_config_props(AVFilterLink *outlink) outlink->h = s->h; outlink->time_base = s->time_base; + if (s->destruct && s->instance) + s->destruct(s->instance); if (!(s->instance = s->construct(outlink->w, outlink->h))) { av_log(ctx, AV_LOG_ERROR, "Impossible to load frei0r instance"); return AVERROR(EINVAL);