diff options
author | Martin Storsjö <martin@martin.st> | 2013-08-26 10:45:27 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-08-27 10:26:10 +0300 |
commit | 0fb3e1c6ce50ae4366c7e5571f2a8278d7fd6297 (patch) | |
tree | a32fc1f768230a69f584d8a60ddfdaf286e73489 /libavformat/movenc.c | |
parent | 2bbad1f94cbc5eab0aa2d937bc79d085477d0242 (diff) | |
download | ffmpeg-0fb3e1c6ce50ae4366c7e5571f2a8278d7fd6297.tar.gz |
movenc: Check for errors from mov_create_chapter_track
On failures in the write_trailer function, we could also ignore
the errors and try to finish the file despite these errors (which
would only leave an incomplete chapters track). It's probably better
to signal the error clearly to the caller though (and if this
function failed there's no guarantee that there's enough memory to
finish the trailer either).
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r-- | libavformat/movenc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 55b16ee337..5836f5e202 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -3303,7 +3303,8 @@ static int mov_write_header(AVFormatContext *s) mov->time += 0x7C25B080; // 1970 based -> 1904 based if (mov->chapter_track) - mov_create_chapter_track(s, mov->chapter_track); + if (mov_create_chapter_track(s, mov->chapter_track) < 0) + goto error; if (mov->flags & FF_MOV_FLAG_RTP_HINT) { /* Initialize the hint tracks for each audio and video stream */ @@ -3456,7 +3457,8 @@ static int mov_write_trailer(AVFormatContext *s) if (!mov->chapter_track && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) { if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) { mov->chapter_track = mov->nb_streams++; - mov_create_chapter_track(s, mov->chapter_track); + if ((res = mov_create_chapter_track(s, mov->chapter_track)) < 0) + goto error; } } @@ -3506,6 +3508,7 @@ static int mov_write_trailer(AVFormatContext *s) } } +error: mov_free(s); return res; |