[FFmpeg-devel] [PATCH] avcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Thu Nov 12 08:18:51 EET 2020


Fixes Coverity ID 1469181.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
Intend to apply this triviality soon.

 libavcodec/adpcmenc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/adpcmenc.c b/libavcodec/adpcmenc.c
index 20568cfc89..4bab004dac 100644
--- a/libavcodec/adpcmenc.c
+++ b/libavcodec/adpcmenc.c
@@ -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;
-- 
2.25.1



More information about the ffmpeg-devel mailing list