[FFmpeg-devel] [PATCH] fftools/ffmpeg_mux_init: fix a memory leak in ffmpeg_mux_init.c

LuMingYin lumingyindetect at 163.com
Sat Apr 13 05:37:26 EEST 2024


Signed-off-by: LuMingYin <lumingyindetect at 163.com>
---
 fftools/ffmpeg_mux_init.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 6d8bd5bcdf..d2146cef8c 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -2851,8 +2851,10 @@ static int parse_forced_key_frames(void *log, KeyframeForceCtx *kf,
 
             if (nb_ch > INT_MAX - size ||
                 !(pts = av_realloc_f(pts, size += nb_ch - 1,
-                                     sizeof(*pts))))
-                return AVERROR(ENOMEM);
+                                     sizeof(*pts)))) {
+                ret = AVERROR(ENOMEM);
+                goto fail;
+            }
 
             if (p[8]) {
                 ret = av_parse_time(&t, p + 8, 1);
-- 
2.25.1



More information about the ffmpeg-devel mailing list