]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
dumpe2fs, resize2fs: avoid memory leak on error path
authorzhanchengbin <zhanchengbin1@huawei.com>
Fri, 31 Dec 2021 07:42:40 +0000 (15:42 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 May 2022 00:56:17 +0000 (20:56 -0400)
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>
misc/dumpe2fs.c
resize/resize2fs.c

index 3f4fc4ede1b6fdd288faf8c0b99fe3512c3c3966..ef6d1cb8285a8c32c3c1961d467d21bda42ec27c 100644 (file)
@@ -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) {
index d69cb01ed65363777b6f57f2152d4b51bf9407b2..916b1f4b435ceb5045c62b74371455eeac13259f 100644 (file)
@@ -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