diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-15 07:13:46 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-19 18:48:30 +0200 |
commit | dac9e88a99ea34c2f812b8f7b6781a84ac86360a (patch) | |
tree | 678c56bdf6de9e939e5fe4669337270447d4312a | |
parent | 6015a6921eba7b01b1e23ebd46f0f9f14b6c6f7b (diff) | |
download | ffmpeg-dac9e88a99ea34c2f812b8f7b6781a84ac86360a.tar.gz |
avcodec/mpegaudiodec_template: Check return value of subdecoder
After all, allocating an AVFloatDSPContext might have failed.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r-- | libavcodec/mpegaudiodec_template.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/mpegaudiodec_template.c b/libavcodec/mpegaudiodec_template.c index de10f71e7b..98759b8e01 100644 --- a/libavcodec/mpegaudiodec_template.c +++ b/libavcodec/mpegaudiodec_template.c @@ -1885,7 +1885,7 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) { MP3On4DecodeContext *s = avctx->priv_data; MPEG4AudioConfig cfg; - int i; + int i, ret; if ((avctx->extradata_size < 2) || !avctx->extradata) { av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n"); @@ -1919,9 +1919,13 @@ static av_cold int decode_init_mp3on4(AVCodecContext * avctx) goto alloc_fail; // Put decoder context in place to make init_decode() happy avctx->priv_data = s->mp3decctx[0]; - decode_init(avctx); + ret = decode_init(avctx); // Restore mp3on4 context pointer avctx->priv_data = s; + if (ret < 0) { + decode_close_mp3on4(avctx); + return ret; + } s->mp3decctx[0]->adu_mode = 1; // Set adu mode /* Create a separate codec/context for each frame (first is already ok). |