[COVERITY] Fix (error case only) memory leak in e2fsck pass #4

Coverity ID: 42: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
bitmap-optimize
Brian Behlendorf 2007-03-28 12:43:05 -04:00 committed by Theodore Ts'o
parent 1db4c4397d
commit 06c9c6ffc1
2 changed files with 4 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* pass1.c (e2fsck_pass1, check_ext_attr),
pass5.c (check_block_bitmaps, check_inode_bitmaps),
swapfs.c (swap_inodes),
pass4.c (e2fsck_pass4), swapfs.c (swap_inodes),
unix.c (parse_extended_opts): Fix memory leaks
2007-03-21 Theodore Tso <tytso@mit.edu>

View File

@ -114,12 +114,12 @@ void e2fsck_pass4(e2fsck_t ctx)
/* Protect loop from wrap-around if s_inodes_count maxed */
for (i=1; i <= fs->super->s_inodes_count && i > 0; i++) {
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
return;
goto errout;
if ((i % fs->super->s_inodes_per_group) == 0) {
group++;
if (ctx->progress)
if ((ctx->progress)(ctx, 4, group, maxgroup))
return;
goto errout;
}
if (i == EXT2_BAD_INO ||
(i > EXT2_ROOT_INO && i < EXT2_FIRST_INODE(fs->super)))
@ -167,6 +167,7 @@ void e2fsck_pass4(e2fsck_t ctx)
ctx->inode_bb_map = 0;
ext2fs_free_inode_bitmap(ctx->inode_imagic_map);
ctx->inode_imagic_map = 0;
errout:
if (buf)
ext2fs_free_mem(&buf);
#ifdef RESOURCE_TRACK