PR #24872 opened by michaelni
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24872
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24872.patch

Found by running FATE with LeakSanitizer
Fixes: memleak
Fixes: fate-filter-gainmap, fate-filter-gainmap-luma, 
fate-filter-gainmap-maxrgb, fate-filter-gainmap-fixed, fate-jpeg-mpf-gainmap 
with AddressSanitizer



>From e7fb9fb03dd683b40ba7424ba89ca19e30f34b3c Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <[email protected]>
Date: Fri, 2 Oct 2026 03:12:32 +0200
Subject: [PATCH] avfilter/vf_gainmap: do not take ownership of the base frame

Found by running FATE with LeakSanitizer
Fixes: memleak
Fixes: fate-filter-gainmap, fate-filter-gainmap-luma, 
fate-filter-gainmap-maxrgb, fate-filter-gainmap-fixed, fate-jpeg-mpf-gainmap 
with AddressSanitizer
---
 libavfilter/vf_gainmap.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavfilter/vf_gainmap.c b/libavfilter/vf_gainmap.c
index 866fef53a6..98ea8b9177 100644
--- a/libavfilter/vf_gainmap.c
+++ b/libavfilter/vf_gainmap.c
@@ -623,8 +623,9 @@ static int process_frame(FFFrameSync *fs)
     AVFilterLink *outlink = ctx->outputs[0];
     AVFrame *base, *alt, *out;
 
-    int ret = ff_framesync_dualinput_get(fs, &base, &alt);
-    if (ret < 0)
+    int ret;
+    if ((ret = ff_framesync_get_frame(fs, 0, &base, 0)) < 0 ||
+        (ret = ff_framesync_get_frame(fs, 1, &alt,  0)) < 0)
         return ret;
     if (!base || !alt)
         return AVERROR_BUG;
@@ -637,6 +638,7 @@ static int process_frame(FFFrameSync *fs)
     if (!out)
         return AVERROR(ENOMEM);
     av_frame_copy_props(out, base);
+    out->pts = av_rescale_q(fs->pts, fs->time_base, outlink->time_base);
     av_frame_side_data_remove_by_props(&out->side_data, &out->nb_side_data,
                                        AV_SIDE_DATA_PROP_COLOR_DEPENDENT);
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to