aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-31 08:49:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-03-31 08:52:35 +0200
commit2d54bbb9502442b84e19c5f424a566a35cf852c6 (patch)
treec5a5c3eb0e849677103bb0df206e9bca12954d78
parentc5f9a66f7453f44d0bf612ad3c5e98e7309cdf86 (diff)
downloadffmpeg-2d54bbb9502442b84e19c5f424a566a35cf852c6.tar.gz
vsrc_buffer: Store allocated scale filter and free it later.
Fixes a memleak. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavfilter/vsrc_buffer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavfilter/vsrc_buffer.c b/libavfilter/vsrc_buffer.c
index 743698eff9..dbccbe07fb 100644
--- a/libavfilter/vsrc_buffer.c
+++ b/libavfilter/vsrc_buffer.c
@@ -32,6 +32,7 @@
typedef struct {
AVFilterBufferRef *picref;
+ AVFilterContext *scale;
int h, w;
enum PixelFormat pix_fmt;
AVRational time_base; ///< time_base to set in the output link
@@ -81,14 +82,14 @@ int av_vsrc_buffer_add_video_buffer_ref(AVFilterContext *buffer_filter,
if ((ret = avfilter_open(&scale, f, "Input equalizer")) < 0)
return ret;
+ c->scale = scale;
+
snprintf(scale_param, sizeof(scale_param)-1, "%d:%d:%s", c->w, c->h, c->sws_param);
if ((ret = avfilter_init_filter(scale, scale_param, NULL)) < 0) {
- avfilter_free(scale);
return ret;
}
if ((ret = avfilter_insert_filter(buffer_filter->outputs[0], scale, 0, 0)) < 0) {
- avfilter_free(scale);
return ret;
}
scale->outputs[0]->time_base = scale->inputs[0]->time_base;
@@ -188,6 +189,8 @@ static av_cold void uninit(AVFilterContext *ctx)
if (s->picref)
avfilter_unref_buffer(s->picref);
s->picref = NULL;
+ avfilter_free(s->scale);
+ s->scale = NULL;
}
static int query_formats(AVFilterContext *ctx)