PR #24720 opened by ffmpeg-devel
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24720
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24720.patch

**Backport:** https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24700

Fixes: #YWH-PGM40646-48


>From 45e8e0a3ff8ce2d0b7fea3bff6366ef0e0bb05aa Mon Sep 17 00:00:00 2001
From: Timo Rothenpieler <[email protected]>
Date: Fri, 25 Sep 2026 23:24:30 +0200
Subject: [PATCH] avformat/mov: don't leak on realloc failure

Fixes: #YWH-PGM40646-48
(cherry picked from commit d97584959417519597a24c8fdd13dc4b9af1a876)
---
 libavformat/mov.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d837a8d582..e998a01ef2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4457,9 +4457,8 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 
                     if (edit_list_start_encountered == 0) {
                         num_discarded_begin++;
-                        frame_duration_buffer = 
av_realloc(frame_duration_buffer,
-                                                           num_discarded_begin 
* sizeof(int64_t));
-                        if (!frame_duration_buffer) {
+                        if (av_reallocp_array(&frame_duration_buffer, 
num_discarded_begin,
+                                              sizeof(*frame_duration_buffer)) 
< 0) {
                             av_log(mov->fc, AV_LOG_ERROR, "Cannot reallocate 
frame duration buffer\n");
                             break;
                         }
-- 
2.52.0

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

Reply via email to