PR #24888 opened by Zhao Zhili (quink) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24888 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24888.patch
# Summary of changes Fix fate-filter-gainmap failure. >From d3b67aed625791511fb12f4d076117427e4201e0 Mon Sep 17 00:00:00 2001 From: Zhao Zhili <[email protected]> Date: Mon, 5 Oct 2026 21:37:13 +0800 Subject: [PATCH] avfilter/vf_gainmap: fix leak of the base frame Fix fate-filter-gainmap failure. --- libavfilter/vf_gainmap.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_gainmap.c b/libavfilter/vf_gainmap.c index 866fef53a6..f110c42d6e 100644 --- a/libavfilter/vf_gainmap.c +++ b/libavfilter/vf_gainmap.c @@ -621,21 +621,25 @@ static int process_frame(FFFrameSync *fs) AVFilterContext *ctx = fs->parent; GainMapContext *s = ctx->priv; AVFilterLink *outlink = ctx->outputs[0]; - AVFrame *base, *alt, *out; + AVFrame *base, *alt, *out = NULL; int ret = ff_framesync_dualinput_get(fs, &base, &alt); if (ret < 0) return ret; - if (!base || !alt) - return AVERROR_BUG; + if (!base || !alt) { + ret = AVERROR_BUG; + goto fail; + } ret = setup_colorspace(ctx, base, alt); if (ret < 0) - return ret; + goto fail; out = ff_get_video_buffer(outlink, outlink->w, outlink->h); - if (!out) - return AVERROR(ENOMEM); + if (!out) { + ret = AVERROR(ENOMEM); + goto fail; + } av_frame_copy_props(out, base); av_frame_side_data_remove_by_props(&out->side_data, &out->nb_side_data, AV_SIDE_DATA_PROP_COLOR_DEPENDENT); @@ -679,12 +683,16 @@ skip:; } *params = s->params; - if (av_gain_map_params_validate(params) < 0) - return AVERROR_BUG; /* should never happen */ + if (av_gain_map_params_validate(params) < 0) { + ret = AVERROR_BUG; /* should never happen */ + goto fail; + } + av_frame_free(&base); return ff_filter_frame(outlink, out); fail: + av_frame_free(&base); av_frame_free(&out); return ret; } -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
