aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhanchengbin <zhanchengbin1@huawei.com>2021-12-31 15:42:40 +0800
committerTheodore Ts'o <tytso@mit.edu>2022-05-11 20:56:17 -0400
commitba18f6efec62a1706b4bcf8fffd27611022260b8 (patch)
treea7be92d5ef2d6134d0e682fb62008734c19109ad
parenta26abc5a1e2fff9d679887445d313b4b9f946f64 (diff)
downloade2fsprogs-ba18f6efec62a1706b4bcf8fffd27611022260b8.tar.gz
dumpe2fs, resize2fs: avoid memory leak on error path
Link: https://lore.kernel.org/r/cbfd9852-bc89-1e83-f101-36fd29a0e70e@huawei.com Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--misc/dumpe2fs.c1
-rw-r--r--resize/resize2fs.c4
2 files changed, 3 insertions, 2 deletions
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index 3f4fc4ede..ef6d1cb82 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -338,6 +338,7 @@ static void list_bad_blocks(ext2_filsys fs, int dump)
if (retval) {
com_err("ext2fs_badblocks_list_iterate_begin", retval,
"%s", _("while printing bad block list"));
+ ext2fs_badblocks_list_free(bb_list);
return;
}
if (dump) {
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index d69cb01ed..916b1f4b4 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1781,11 +1781,11 @@ static errcode_t block_mover(ext2_resize_t rfs)
fs->inode_blocks_per_group,
&rfs->itable_buf);
if (retval)
- return retval;
+ goto errout;
}
retval = ext2fs_create_extent_table(&rfs->bmap, 0);
if (retval)
- return retval;
+ goto errout;
/*
* The first step is to figure out where all of the blocks