bitstream: fix a crash in case of oom
authorPiotr Bandurski <ami_stuff@o2.pl>
Tue, 9 Jul 2013 17:29:26 +0000 (19:29 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 9 Jul 2013 17:41:22 +0000 (19:41 +0200)
fixes ticket #2766

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/bitstream.c

index 23bea43..bbd9491 100644 (file)
@@ -299,6 +299,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);
 
     av_assert0(symbols_size <= 2 || !symbols);
     j = 0;