History

avfilter/vf_gblur: fix memory leaks if config_input() is called again

Paul B Mahol committed 4 years ago

Commit f89cd451 parent a0ede3c1 file · +10 −8Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_gblur.c+10−8
@@ -249,11 +249,21 @@ void ff_gblur_init(GBlurContext *s) · 248 unmodified lines
249249 ff_gblur_init_x86(s);
250250 }
251251
252+static av_cold void uninit(AVFilterContext *ctx)
253+{
254+ GBlurContext *s = ctx->priv;
255+
256+ av_freep(&s->buffer);
257+ av_freep(&s->localbuf);
258+}
259+
252260 static int config_input(AVFilterLink *inlink)
253261 {
254262 const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
255263 GBlurContext *s = inlink->dst->priv;
256264
265+ uninit(inlink->dst);
266+
257267 s->depth = desc->comp[0].depth;
258268 s->flt = !!(desc->flags & AV_PIX_FMT_FLAG_FLOAT);
259269 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) · 119 unmodified lines
379389 return ff_filter_frame(outlink, out);
380390 }
381391
382−static av_cold void uninit(AVFilterContext *ctx)
383−{
384− GBlurContext *s = ctx->priv;
385−
386− av_freep(&s->buffer);
387− av_freep(&s->localbuf);
388−}
389−
390392 static const AVFilterPad gblur_inputs[] = {
391393 {
392394 .name = "default",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t