public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Wu Guanghao <wuguanghao3@huawei.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
	linux-ext4@vger.kernel.org, yangyun50@huawei.com
Subject: Re: [PATCH 1/2] fsck: fix memory leak of inst->type
Date: Tue, 18 Nov 2025 22:32:22 -0800	[thread overview]
Message-ID: <20251119063222.GR196358@frogsfrogsfrogs> (raw)
In-Reply-To: <3a3e1417-3f59-5bb9-337c-518ae2f43f49@huawei.com>

On Wed, Nov 19, 2025 at 09:25:00AM +0800, Wu Guanghao wrote:
> 
> 
> 在 2025/11/19 2:30, Darrick J. Wong 写道:
> > On Tue, Nov 18, 2025 at 09:26:00PM +0800, Wu Guanghao wrote:
> >> The function free_instance() does not release i->type, resulting in a
> >> memory leak.
> > 
> > Does anyone still use this wrapper?  I thought everyone used the
> > /sbin/fsck from util-linux...
> > 
> > --D
> 
> The issue was discovered while running the ext4 test cases in xfstests.
> I cannot confirm whether other users are encountering the same problem,
> but the issue definitely exists.
> 
> I also pushed a patch to fix a memory leak caused by duplicate memory
> allocation in xfsprogs. If you have the time, could you please review it?
> Thank you.

Someone else already sent a fix patch last month.

--D

> > 
> >> Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
> >> ---
> >>  misc/fsck.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/misc/fsck.c b/misc/fsck.c
> >> index 64d0e7c0..a06f2668 100644
> >> --- a/misc/fsck.c
> >> +++ b/misc/fsck.c
> >> @@ -235,6 +235,7 @@ static void parse_escape(char *word)
> >>  static void free_instance(struct fsck_instance *i)
> >>  {
> >>  	free(i->prog);
> >> +	free(i->type);
> >>  	free(i->device);
> >>  	free(i->base_device);
> >>  	free(i);
> >> -- 
> >> 2.27.0
> >>
> >>
> > 
> > .
> 

  reply	other threads:[~2025-11-19  6:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 13:25 [PATCH 0/2] e2fsprogs: fix memory leaks detected by ASAN Wu Guanghao
2025-11-18 13:26 ` [PATCH 1/2] fsck: fix memory leak of inst->type Wu Guanghao
2025-11-18 18:30   ` Darrick J. Wong
2025-11-19  1:25     ` Wu Guanghao
2025-11-19  6:32       ` Darrick J. Wong [this message]
2025-11-18 13:26 ` [PATCH 2/2] resize: fix memory leak when exiting normally Wu Guanghao
2025-11-18 18:29   ` Darrick J. Wong
2025-11-19  1:52     ` Wu Guanghao
2025-11-19  6:26       ` Darrick J. Wong
2025-11-20  3:45         ` Wu Guanghao

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=20251119063222.GR196358@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=wuguanghao3@huawei.com \
    --cc=yangyun50@huawei.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox