diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-01-30 13:15:18 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-01-30 19:12:55 -0500 |
commit | dd88ae831a3e703ec48b28a3b28e96567eab605f (patch) | |
tree | 525318836229181c49f0f2d0054f1de084a4a3ec /libavcodec | |
parent | 877a1d409c13887903cf6aa5d8ac01fd8091a3f2 (diff) | |
download | ffmpeg-dd88ae831a3e703ec48b28a3b28e96567eab605f.tar.gz |
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().
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/adpcmenc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c index f0f8c1f528..706c5048c7 100644 --- a/libavcodec/adpcmenc.c +++ b/libavcodec/adpcmenc.c @@ -110,10 +110,10 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx) avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; avctx->block_align = BLKSIZE; + if (!(avctx->extradata = av_malloc(32 + FF_INPUT_BUFFER_PADDING_SIZE))) + goto error; avctx->extradata_size = 32; - extradata = avctx->extradata = av_malloc(avctx->extradata_size); - if (!extradata) - return AVERROR(ENOMEM); + extradata = avctx->extradata; bytestream_put_le16(&extradata, avctx->frame_size); bytestream_put_le16(&extradata, 7); /* wNumCoef */ for (i = 0; i < 7; i++) { |