X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fresample.c;h=7c0f828be26f4109bc327abb9e629fe36d63ebd8;hb=ec59f027ac749f5a10fa7c6243e532bf0bc57f9d;hp=f9502880e01a3bd44298d33ab8c2e7521fb82029;hpb=19b79c1429c4234b6ca60ca21e0ed8a152db1343;p=ffmpeg diff --git a/libavcodec/resample.c b/libavcodec/resample.c index f9502880e01..7c0f828be26 100644 --- a/libavcodec/resample.c +++ b/libavcodec/resample.c @@ -347,10 +347,10 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl /* XXX: move those malloc to resample init code */ for (i = 0; i < s->filter_channels; i++) { - bufin[i] = av_malloc((nb_samples + s->temp_len) * sizeof(short)); + bufin[i] = av_malloc_array((nb_samples + s->temp_len), sizeof(short)); memcpy(bufin[i], s->temp[i], s->temp_len * sizeof(short)); buftmp2[i] = bufin[i] + s->temp_len; - bufout[i] = av_malloc(lenout * sizeof(short)); + bufout[i] = av_malloc_array(lenout, sizeof(short)); } if (s->input_channels == 2 && s->output_channels == 1) { @@ -384,7 +384,7 @@ int audio_resample(ReSampleContext *s, short *output, short *input, int nb_sampl nb_samples1 = av_resample(s->resample_context, buftmp3[i], bufin[i], &consumed, nb_samples, lenout, is_last); s->temp_len = nb_samples - consumed; - s->temp[i] = av_realloc(s->temp[i], s->temp_len * sizeof(short)); + s->temp[i] = av_realloc_array(s->temp[i], s->temp_len, sizeof(short)); memcpy(s->temp[i], bufin[i] + consumed, s->temp_len * sizeof(short)); }