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

When clone_side_data() fails in fg_output_step(), the function returns
without calling av_frame_unref(frame), leaking the frame reference.


>From 57236d4aed756d97ff49318142016d8b5e7cf9a4 Mon Sep 17 00:00:00 2001
From: jiangjie <[email protected]>
Date: Wed, 13 May 2026 20:37:15 +0800
Subject: [PATCH] fftools/ffmpeg_filter: fix frame reference leak in
 fg_output_step

When clone_side_data() fails in fg_output_step(), the function returns
without calling av_frame_unref(frame), leaking the frame reference.
---
 fftools/ffmpeg_filter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 1240abbde2..38e39d68af 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -2841,8 +2841,10 @@ static int fg_output_step(OutputFilterPriv *ofp, 
FilterGraphThread *fgt,
     if (!fgt->got_frame) {
         ret = clone_side_data(&fd->side_data, &fd->nb_side_data,
                               ofp->side_data, ofp->nb_side_data, 0);
-        if (ret < 0)
+        if (ret < 0) {
+            av_frame_unref(frame);
             return ret;
+        }
     }
 
     fd->wallclock[LATENCY_PROBE_FILTER_POST] = av_gettime_relative();
-- 
2.52.0

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

Reply via email to