avcodec/libopencore-amr: use av_mallocz_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
5b30f27592
commit
818aaa7636
@ -241,7 +241,7 @@ static int amr_nb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
|
|||||||
|
|
||||||
if (frame) {
|
if (frame) {
|
||||||
if (frame->nb_samples < avctx->frame_size) {
|
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)
|
if (!flush_buf)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
memcpy(flush_buf, samples, frame->nb_samples * sizeof(*flush_buf));
|
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 {
|
} else {
|
||||||
if (s->enc_last_frame < 0)
|
if (s->enc_last_frame < 0)
|
||||||
return 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)
|
if (!flush_buf)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
samples = flush_buf;
|
samples = flush_buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user