• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From ba18f6efec62a1706b4bcf8fffd27611022260b8 Mon Sep 17 00:00:00 2001
2From: zhanchengbin <zhanchengbin1@huawei.com>
3Date: Fri, 31 Dec 2021 15:42:40 +0800
4Subject: dumpe2fs, resize2fs: avoid memory leak on error path
5
6Link: https://lore.kernel.org/r/cbfd9852-bc89-1e83-f101-36fd29a0e70e@huawei.com
7Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
8Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9---
10 misc/dumpe2fs.c    | 1 +
11 resize/resize2fs.c | 4 ++--
12 2 files changed, 3 insertions(+), 2 deletions(-)
13
14diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
15index 3f4fc4ed..ef6d1cb8 100644
16--- a/misc/dumpe2fs.c
17+++ b/misc/dumpe2fs.c
18@@ -338,6 +338,7 @@ static void list_bad_blocks(ext2_filsys fs, int dump)
19 	if (retval) {
20 		com_err("ext2fs_badblocks_list_iterate_begin", retval,
21 			"%s", _("while printing bad block list"));
22+		ext2fs_badblocks_list_free(bb_list);
23 		return;
24 	}
25 	if (dump) {
26diff --git a/resize/resize2fs.c b/resize/resize2fs.c
27index d69cb01e..916b1f4b 100644
28--- a/resize/resize2fs.c
29+++ b/resize/resize2fs.c
30@@ -1781,11 +1781,11 @@ static errcode_t block_mover(ext2_resize_t rfs)
31 					fs->inode_blocks_per_group,
32 					&rfs->itable_buf);
33 		if (retval)
34-			return retval;
35+			goto errout;
36 	}
37 	retval = ext2fs_create_extent_table(&rfs->bmap, 0);
38 	if (retval)
39-		return retval;
40+		goto errout;
41
42 	/*
43 	 * The first step is to figure out where all of the blocks
44--
45cgit
46
47