diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2020-03-21 18:31:06 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-07-08 13:05:22 +0200 |
commit | 7c684827d90d82822f426d73564cee8479fccc7b (patch) | |
tree | 2d5159966a64b59f8b9cce97776e4267d68ae59b /libavformat/oggdec.c | |
parent | 3bb61f55b7e3f34e815ae8267e543429a8eac8c3 (diff) | |
download | ffmpeg-7c684827d90d82822f426d73564cee8479fccc7b.tar.gz |
avformat/oggdec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/oggdec.c')
-rw-r--r-- | libavformat/oggdec.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index e5ca3272cd..bb289e0756 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -732,10 +732,8 @@ static int ogg_read_header(AVFormatContext *s) //linear headers seek from start do { ret = ogg_packet(s, NULL, NULL, NULL, NULL); - if (ret < 0) { - ogg_read_close(s); + if (ret < 0) return ret; - } } while (!ogg->headers); av_log(s, AV_LOG_TRACE, "found headers\n"); @@ -751,10 +749,8 @@ static int ogg_read_header(AVFormatContext *s) "Headers mismatch for stream %d: " "expected %d received %d.\n", i, os->codec->nb_header, os->nb_header); - if (s->error_recognition & AV_EF_EXPLODE) { - ogg_read_close(s); + if (s->error_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; - } } if (os->start_granule != OGG_NOGRANULE_VALUE) os->lastpts = s->streams[i]->start_time = @@ -763,10 +759,8 @@ static int ogg_read_header(AVFormatContext *s) //linear granulepos seek from end ret = ogg_get_length(s); - if (ret < 0) { - ogg_read_close(s); + if (ret < 0) return ret; - } return 0; } @@ -970,6 +964,7 @@ const AVInputFormat ff_ogg_demuxer = { .name = "ogg", .long_name = NULL_IF_CONFIG_SMALL("Ogg"), .priv_data_size = sizeof(struct ogg), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = ogg_probe, .read_header = ogg_read_header, .read_packet = ogg_read_packet, |