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-07 21:40:13 +0200 |
commit | 1500b7dfa569aae96d4de18e11ee0f6e55f4d72d (patch) | |
tree | 21fd5f1d1297901fdbf7c730e6b647aa439d46bd | |
parent | ef7eaa4529b2c536bf0682f05508b98114795ac1 (diff) | |
download | ffmpeg-1500b7dfa569aae96d4de18e11ee0f6e55f4d72d.tar.gz |
avformat/av1dec: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavformat/av1dec.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavformat/av1dec.c b/libavformat/av1dec.c index 8ca804c2a3..8a68deb272 100644 --- a/libavformat/av1dec.c +++ b/libavformat/av1dec.c @@ -77,17 +77,14 @@ static int read_header(AVFormatContext *s, const AVRational *framerate, AVBSFCon return ret; ret = avcodec_parameters_copy((*bsf)->par_in, st->codecpar); - if (ret < 0) { - av_bsf_free(bsf); + if (ret < 0) return ret; - } ret = av_bsf_init(*bsf); if (ret < 0) - av_bsf_free(bsf); - - return ret; + return ret; + return 0; } #define DEC AV_OPT_FLAG_DECODING_PARAM @@ -285,6 +282,7 @@ const AVInputFormat ff_av1_demuxer = { .name = "av1", .long_name = NULL_IF_CONFIG_SMALL("AV1 Annex B"), .priv_data_size = sizeof(AnnexBContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = annexb_probe, .read_header = annexb_read_header, .read_packet = annexb_read_packet, @@ -472,6 +470,7 @@ const AVInputFormat ff_obu_demuxer = { .name = "obu", .long_name = NULL_IF_CONFIG_SMALL("AV1 low overhead OBU"), .priv_data_size = sizeof(ObuContext), + .flags_internal = FF_FMT_INIT_CLEANUP, .read_probe = obu_probe, .read_header = obu_read_header, .read_packet = obu_read_packet, |