n = frame->nb_samples * avctx->channels;
samples = (const short *)frame->data[0];
- if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size, 0)) < 0)
+ if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size, n * sample_size)) < 0)
return ret;
dst = avpkt->data;