[FFmpeg-cvslog] avformat/nutenc: don't allocate a dynamic AVIOContext if no index is going to be written

James Almer git at videolan.org
Thu May 5 23:33:53 EEST 2022


ffmpeg | branch: release/2.8 | James Almer <jamrial at gmail.com> | Fri Oct 18 20:53:10 2019 -0300| [40dfd623632ed22bf3c98465ae3e68fcb1f31200] | committer: Michael Niedermayer

avformat/nutenc: don't allocate a dynamic AVIOContext if no index is going to be written

Fixes ticket #8295

Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit 1d479300cbe0522c233b7d51148aea2b29bd29ad)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=40dfd623632ed22bf3c98465ae3e68fcb1f31200
---

 libavformat/nutenc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index e5eb82504a..2c09c38bd8 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -1180,8 +1180,11 @@ static int nut_write_trailer(AVFormatContext *s)
     while (nut->header_count < 3)
         write_headers(s, bc);
 
+    if (!nut->sp_count)
+        return 0;
+
     ret = avio_open_dyn_buf(&dyn_bc);
-    if (ret >= 0 && nut->sp_count) {
+    if (ret >= 0) {
         av_assert1(nut->write_index); // sp_count should be 0 if no index is going to be written
         write_index(nut, dyn_bc);
         put_packet(nut, bc, dyn_bc, 1, INDEX_STARTCODE);



More information about the ffmpeg-cvslog mailing list