mirror of https://git.ffmpeg.org/ffmpeg.git
adpcmenc: fix adpcm_ms extradata allocation
Add FF_INPUT_BUFFER_PADDING_SIZE. If allocation fails, also free memory which was allocated previously in adpcm_encode_init().
This commit is contained in:
parent
877a1d409c
commit
dd88ae831a
|
@ -110,10 +110,10 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
|
||||||
avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 /
|
avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 /
|
||||||
avctx->channels + 2;
|
avctx->channels + 2;
|
||||||
avctx->block_align = BLKSIZE;
|
avctx->block_align = BLKSIZE;
|
||||||
|
if (!(avctx->extradata = av_malloc(32 + FF_INPUT_BUFFER_PADDING_SIZE)))
|
||||||
|
goto error;
|
||||||
avctx->extradata_size = 32;
|
avctx->extradata_size = 32;
|
||||||
extradata = avctx->extradata = av_malloc(avctx->extradata_size);
|
extradata = avctx->extradata;
|
||||||
if (!extradata)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
bytestream_put_le16(&extradata, avctx->frame_size);
|
bytestream_put_le16(&extradata, avctx->frame_size);
|
||||||
bytestream_put_le16(&extradata, 7); /* wNumCoef */
|
bytestream_put_le16(&extradata, 7); /* wNumCoef */
|
||||||
for (i = 0; i < 7; i++) {
|
for (i = 0; i < 7; i++) {
|
||||||
|
|
Loading…
Reference in New Issue