[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251121033612.2423536-3-wuguanghao3@huawei.com>
Date: Fri, 21 Nov 2025 11:36:12 +0800
From: Wu Guanghao <wuguanghao3@...wei.com>
To: <tytso@....edu>, <linux-ext4@...r.kernel.org>, <adilger.kernel@...ger.ca>
CC: <djwong@...nel.org>, <yangyun50@...wei.com>, <wuguanghao3@...wei.com>
Subject: [PATCH v2 2/2] resize: fix memory leak when exiting normally
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 | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/resize/main.c b/resize/main.c
index 08a4bbaf..e7940307 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -702,6 +702,14 @@ int main (int argc, char ** argv)
}
if (fd > 0)
close(fd);
+
+ retval = ext2fs_close_free(&fs);
+ if (retval) {
+ com_err(program_name, retval,
+ _("ext2fs_close"));
+ exit(1);
+ }
+
remove_error_table(&et_ext2_error_table);
return 0;
errout:
--
2.27.0
Powered by blists - more mailing lists