avcodec/cngenc: Use av_malloc_array()
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 22 Apr 2014 00:38:03 +0000 (02:38 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 22 Apr 2014 00:38:03 +0000 (02:38 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/cngenc.c

index 5ab6e36..bf5f7bf 100644 (file)
@@ -56,8 +56,8 @@ static av_cold int cng_encode_init(AVCodecContext *avctx)
     p->order = 10;
     if ((ret = ff_lpc_init(&p->lpc, avctx->frame_size, p->order, FF_LPC_TYPE_LEVINSON)) < 0)
         return ret;
-    p->samples32 = av_malloc(avctx->frame_size * sizeof(*p->samples32));
-    p->ref_coef = av_malloc(p->order * sizeof(*p->ref_coef));
+    p->samples32 = av_malloc_array(avctx->frame_size, sizeof(*p->samples32));
+    p->ref_coef = av_malloc_array(p->order, sizeof(*p->ref_coef));
     if (!p->samples32 || !p->ref_coef) {
         cng_encode_close(avctx);
         return AVERROR(ENOMEM);