1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avcodec/libdavs2: workaround memory leak

davs2_decoder_close doesn't free those on the fly frames which
don't get output yet. It's a design bug, but easy to workaround.

Before the patch:
Direct leak of 1198606 byte(s) in 2 object(s) allocated from:
    #0 0x563af5e1e5f0 in malloc (ffmpeg+0x6675f0)
    #1 0x563af9765ef3 in davs2_malloc davs2/source/common/common.h:1240
    #2 0x563af9765ef3 in davs2_alloc_picture davs2/source/common/header.cc:815

Indirect leak of 3595818 byte(s) in 6 object(s) allocated from:
    #0 0x563af5e1e5f0 in malloc (ffmpeg+0x6675f0)
    #1 0x563af9765ef3 in davs2_malloc davs2/source/common/common.h:1240
    #2 0x563af9765ef3 in davs2_alloc_picture davs2/source/common/header.cc:815

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
Zhao Zhili 2022-06-27 17:57:27 +08:00 committed by Zhao Zhili
parent 9fec43a92d
commit 066368e837

View File

@ -177,6 +177,7 @@ static av_cold int davs2_end(AVCodecContext *avctx)
/* close the decoder */
if (cad->decoder) {
davs2_flush(avctx);
davs2_decoder_close(cad->decoder);
cad->decoder = NULL;
}