diff mbox series

[FFmpeg-devel,03/20] avcodec/wma: Check initializing VLC

Message ID HE1PR0301MB2154355AE5AA9F1B6C92D7BF8F579@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit cb8f01951b3e594f754d4d240f66cc01d6881e4d
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
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt May 7, 2021, 6:46 a.m. UTC
Initializing a VLC entails implicit allocations which may fail.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/wma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/wma.c b/libavcodec/wma.c
index ee04ef725f..004ffb5515 100644
--- a/libavcodec/wma.c
+++ b/libavcodec/wma.c
@@ -41,9 +41,11 @@  static av_cold int init_coef_vlc(VLC *vlc, uint16_t **prun_table,
     const uint16_t *levels_table = vlc_table->levels;
     uint16_t *run_table, *int_table;
     float *flevel_table;
-    int i, l, j, k, level;
+    int i, l, j, k, level, ret;
 
-    init_vlc(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0);
+    ret = init_vlc(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0);
+    if (ret < 0)
+        return ret;
 
     run_table    = av_malloc_array(n, sizeof(uint16_t));
     flevel_table = av_malloc_array(n, sizeof(*flevel_table));