Commit 1d479300 authored by James Almer's avatar James Almer

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

Fixes ticket #8295
Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 0528adbd
...@@ -1170,8 +1170,11 @@ static int nut_write_trailer(AVFormatContext *s) ...@@ -1170,8 +1170,11 @@ static int nut_write_trailer(AVFormatContext *s)
while (nut->header_count < 3) while (nut->header_count < 3)
write_headers(s, bc); write_headers(s, bc);
if (!nut->sp_count)
return 0;
ret = avio_open_dyn_buf(&dyn_bc); 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 av_assert1(nut->write_index); // sp_count should be 0 if no index is going to be written
write_index(nut, dyn_bc); write_index(nut, dyn_bc);
put_packet(nut, bc, dyn_bc, 1, INDEX_STARTCODE); put_packet(nut, bc, dyn_bc, 1, INDEX_STARTCODE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment