1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV

Fixes Coverity ID 1469181.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
Andreas Rheinhardt 2020-11-12 07:15:29 +01:00
parent ac5b45abab
commit 454bee5be0

View File

@ -876,6 +876,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
bytestream_put_byte(&dst, (buf[2 * i] << 4) | buf[2 * i + 1]); bytestream_put_byte(&dst, (buf[2 * i] << 4) | buf[2 * i + 1]);
samples += 2 * n; samples += 2 * n;
av_free(buf);
} else for (n = frame->nb_samples >> 1; n > 0; n--) { } else for (n = frame->nb_samples >> 1; n > 0; n--) {
int nibble; int nibble;
nibble = adpcm_ima_compress_sample(&c->status[0], *samples++) << 4; nibble = adpcm_ima_compress_sample(&c->status[0], *samples++) << 4;