avcodec/libopencore-amr: use av_mallocz_array()
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Apr 2014 20:37:55 +0000 (22:37 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Apr 2014 21:12:26 +0000 (23:12 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libopencore-amr.c

index 3a8787b..4c7b6af 100644 (file)
@@ -241,7 +241,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 
     if (frame) {
         if (frame->nb_samples < avctx->frame_size) {
-            flush_buf = av_mallocz(avctx->frame_size * sizeof(*flush_buf));
+            flush_buf = av_mallocz_array(avctx->frame_size, sizeof(*flush_buf));
             if (!flush_buf)
                 return AVERROR(ENOMEM);
             memcpy(flush_buf, samples, frame->nb_samples * sizeof(*flush_buf));
@@ -256,7 +256,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
     } else {
         if (s->enc_last_frame < 0)
             return 0;
-        flush_buf = av_mallocz(avctx->frame_size * sizeof(*flush_buf));
+        flush_buf = av_mallocz_array(avctx->frame_size, sizeof(*flush_buf));
         if (!flush_buf)
             return AVERROR(ENOMEM);
         samples = flush_buf;