bitstream: Check the result of av_malloc()
authorDiego Biurrun <diego@biurrun.de>
Tue, 15 Oct 2013 12:34:55 +0000 (14:34 +0200)
committerDiego Biurrun <diego@biurrun.de>
Tue, 15 Oct 2013 16:01:12 +0000 (18:01 +0200)
libavcodec/bitstream.c

index 197e07f..e7c476b 100644 (file)
@@ -283,6 +283,8 @@ int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes,
     av_dlog(NULL, "build table nb_codes=%d\n", nb_codes);
 
     buf = av_malloc((nb_codes + 1) * sizeof(VLCcode));
+    if (!buf)
+        return AVERROR(ENOMEM);
 
     assert(symbols_size <= 2 || !symbols);
     j = 0;