You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avfilter/vf_avgblur: fix memory leaks if config_input() is called again
This commit is contained in:
@@ -187,12 +187,21 @@ static void build_lut(AVFilterContext *ctx, int max)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static av_cold void uninit(AVFilterContext *ctx)
|
||||||
|
{
|
||||||
|
AverageBlurContext *s = ctx->priv;
|
||||||
|
|
||||||
|
av_freep(&s->buffer);
|
||||||
|
}
|
||||||
|
|
||||||
static int config_input(AVFilterLink *inlink)
|
static int config_input(AVFilterLink *inlink)
|
||||||
{
|
{
|
||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
|
||||||
AverageBlurContext *s = ctx->priv;
|
AverageBlurContext *s = ctx->priv;
|
||||||
|
|
||||||
|
uninit(ctx);
|
||||||
|
|
||||||
s->depth = desc->comp[0].depth;
|
s->depth = desc->comp[0].depth;
|
||||||
s->max = 1 << s->depth;
|
s->max = 1 << s->depth;
|
||||||
s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
|
s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, desc->log2_chroma_w);
|
||||||
@@ -316,13 +325,6 @@ static int process_command(AVFilterContext *ctx, const char *cmd, const char *ar
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold void uninit(AVFilterContext *ctx)
|
|
||||||
{
|
|
||||||
AverageBlurContext *s = ctx->priv;
|
|
||||||
|
|
||||||
av_freep(&s->buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const AVFilterPad avgblur_inputs[] = {
|
static const AVFilterPad avgblur_inputs[] = {
|
||||||
{
|
{
|
||||||
.name = "default",
|
.name = "default",
|
||||||
|
Reference in New Issue
Block a user