From: "\"zhilizhao(赵志立)\"" <quinkblack@foxmail.com>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/libdavs2: workaround memory leak
Date: Mon, 4 Jul 2022 11:58:34 +0800
Message-ID: <tencent_62A5CFE3D518270B388596124D162019CD07@qq.com> (raw)
In-Reply-To: <tencent_DA5AE235F1803A35933ED756C59C34E04A09@qq.com>
> On Jun 27, 2022, at 5:57 PM, Zhao Zhili <quinkblack@foxmail.com> wrote:
>
> 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>
> ---
> libavcodec/libdavs2.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
> index d7625718a2..c2040775ae 100644
> --- a/libavcodec/libdavs2.c
> +++ b/libavcodec/libdavs2.c
> @@ -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;
> }
> --
> 2.35.3
>
Applied as 066368e8373d18b496203fa91d98bf11a9b7f59f.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
prev parent reply other threads:[~2022-07-04 3:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 9:57 Zhao Zhili
2022-07-04 3:58 ` "zhilizhao(赵志立)" [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_62A5CFE3D518270B388596124D162019CD07@qq.com \
--to=quinkblack@foxmail.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git