diff options
author | James Almer <jamrial@gmail.com> | 2019-10-18 20:53:10 -0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-05-04 20:00:05 +0200 |
commit | 3a04214c60949185c263ec76692c3b34d6232235 (patch) | |
tree | 751747938a13fe0b52197d3dac0653b3cc651017 /libavformat | |
parent | c6fdee52746eb1aa2a74fc4adb368bf4a376ddf2 (diff) | |
download | ffmpeg-3a04214c60949185c263ec76692c3b34d6232235.tar.gz |
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@gmail.com>
(cherry picked from commit 1d479300cbe0522c233b7d51148aea2b29bd29ad)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/nutenc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 2c2334a69c..7405dc28cc 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -1171,8 +1171,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); |