diff mbox series

[FFmpeg-devel,07/20] avcodec/wmaenc: Check operations that can fail

Message ID HE1PR0301MB2154519BA299F31A958AE93B8F579@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 20232cbbf7cd9f6e2f139db8d3d9c7040a1e5002
Headers show
Series [FFmpeg-devel,01/20] avcodec/wma: Remove nonsense volatile
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 7, 2021, 6:46 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/wmaenc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 2a78325298..3035668487 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -88,8 +88,11 @@  static av_cold int encode_init(AVCodecContext *avctx)
         return ret;
 
     /* init MDCT */
-    for (i = 0; i < s->nb_block_sizes; i++)
-        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
+    for (i = 0; i < s->nb_block_sizes; i++) {
+        ret = ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
+        if (ret < 0)
+            return ret;
+    }
 
     block_align        = avctx->bit_rate * (int64_t) s->frame_len /
                          (avctx->sample_rate * 8);