[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251119062614.GB196391@frogsfrogsfrogs>
Date: Tue, 18 Nov 2025 22:26:14 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: Wu Guanghao <wuguanghao3@...wei.com>
Cc: tytso@....edu, adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
yangyun50@...wei.com
Subject: Re: [PATCH 2/2] resize: fix memory leak when exiting normally
On Wed, Nov 19, 2025 at 09:52:19AM +0800, Wu Guanghao wrote:
>
>
> 在 2025/11/19 2:29, Darrick J. Wong 写道:
> > On Tue, Nov 18, 2025 at 09:26:01PM +0800, Wu Guanghao wrote:
> >> The main() function only releases fs when it exits through the errout or
> >> success_exit labels. When completes normally, it does not release fs.
> >>
> >> Signed-off-by: Wu Guanghao <wuguanghao3@...wei.com>
> >> ---
> >> resize/main.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >>
> >> diff --git a/resize/main.c b/resize/main.c
> >> index 08a4bbaf..71711229 100644
> >> --- a/resize/main.c
> >> +++ b/resize/main.c
> >> @@ -702,6 +702,8 @@ int main (int argc, char ** argv)
> >> }
> >> if (fd > 0)
> >> close(fd);
> >> +
> >> + (void) ext2fs_close_free(&fs);
> >
> > You might want to capture and print an error if one is returned, because
> > ext2fs_close_free will also flush the new metadata to disk.
> >
> > --D
> >
> This is not an error, but a normal process exit. If there is an error,
> it will follow the errout tag.
I can see that, but I'm talking about capturing errors returned by
the new ext2fs_close_free call itself.
--D
> >> remove_error_table(&et_ext2_error_table);
> >> return 0;
> >> errout:
> >> --
> >> 2.27.0
> >>
> >>
> >
> >
> > .
Powered by blists - more mailing lists