dct: Check memory allocation
authorVittorio Giovara <vittorio.giovara@gmail.com>
Sun, 31 May 2015 12:53:31 +0000 (14:53 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Sun, 31 May 2015 13:03:30 +0000 (15:03 +0200)
libavcodec/dct.c

index 4dbbff8..180477e 100644 (file)
@@ -191,6 +191,8 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse)
 
         s->costab = ff_cos_tabs[nbits + 2];
         s->csc2   = av_malloc(n / 2 * sizeof(FFTSample));
+        if (!s->csc2)
+            return AVERROR(ENOMEM);
 
         if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) {
             av_free(s->csc2);