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

index f8c52af..0879615 100644 (file)
@@ -299,6 +299,8 @@ static av_cold int encode_init(AVCodecContext *avctx)
                      avctx->global_quality / 2) / avctx->global_quality;
 
     avctx->extradata                   = av_mallocz(8);
+    if (!avctx->extradata)
+        return AVERROR(ENOMEM);
     avctx->extradata_size              = 8;
     ((uint32_t *) avctx->extradata)[0] = av_le2ne32(a->inv_qscale);
     ((uint32_t *) avctx->extradata)[1] = av_le2ne32(AV_RL32("ASUS"));