diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-05-04 13:06:41 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-05-05 19:17:13 +0200 |
commit | 9b9a61ca77c65c0dbc71a94cc80aac0f4453999b (patch) | |
tree | a8a6417cd00390acb847e28661592621adb148f0 | |
parent | 2ffa8be53b5c469379cb5cfc0f33d5de516756f0 (diff) | |
download | ffmpeg-9b9a61ca77c65c0dbc71a94cc80aac0f4453999b.tar.gz |
avformat/nutenc: Add goto fail in nut_write_headers()
It allows to combine several ffio_free_dyn_buf().
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavformat/nutenc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 6125429cc3..c1606651fe 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -632,8 +632,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc) for (i = 0; i < nut->avf->nb_streams; i++) { ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i); if (ret < 0) { - ffio_free_dyn_buf(&dyn_bc); - return ret; + goto fail; } put_packet(nut, bc, dyn_bc, STREAM_STARTCODE); } @@ -646,16 +645,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc) if (ret > 0) put_packet(nut, bc, dyn_bc, INFO_STARTCODE); else if (ret < 0) { - ffio_free_dyn_buf(&dyn_bc); - return ret; + goto fail; } } for (i = 0; i < nut->avf->nb_chapters; i++) { ret = write_chapter(nut, dyn_bc, i); if (ret < 0) { - ffio_free_dyn_buf(&dyn_bc); - return ret; + goto fail; } put_packet(nut, bc, dyn_bc, INFO_STARTCODE); } @@ -663,9 +660,11 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc) nut->last_syncpoint_pos = INT_MIN; nut->header_count++; + ret = 0; +fail: ffio_free_dyn_buf(&dyn_bc); - return 0; + return ret; } static int nut_write_header(AVFormatContext *s) |