lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251118182919.GP196358@frogsfrogsfrogs>
Date: Tue, 18 Nov 2025 10:29:19 -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 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

>  	remove_error_table(&et_ext2_error_table);
>  	return 0;
>  errout:
> -- 
> 2.27.0
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ