]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 12 Nov 2020 06:15:29 +0000 (07:15 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 12 Nov 2020 06:23:06 +0000 (07:23 +0100)
Fixes Coverity ID 1469181.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavcodec/adpcmenc.c

index 20568cfc89ca265734ab09f4b47caaaa96ae4e61..4bab004dacbc68c91ae349883a569364d2e9a27d 100644 (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]);
 
             samples += 2 * n;
+            av_free(buf);
         } else for (n = frame->nb_samples >> 1; n > 0; n--) {
             int nibble;
             nibble  = adpcm_ima_compress_sample(&c->status[0], *samples++) << 4;