summaryrefslogtreecommitdiff
path: root/e2fsck/pass3.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2013-12-12 12:57:48 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-12-12 12:57:50 -0500
commitf0131bdc6ff2b349e84e4767d9fe8b078a0ee521 (patch)
treef069f118844be88de52779113ad61621940ffdc0 /e2fsck/pass3.c
parent85b8f7affa5fadb1972e82e04cc3d1828966b238 (diff)
downloade2fsprogs-f0131bdc6ff2b349e84e4767d9fe8b078a0ee521.tar.gz
e2fsck: fix memory leaks (on error path)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck/pass3.c')
-rw-r--r--e2fsck/pass3.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 926f462f..fd8ec34e 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -53,7 +53,7 @@ static ext2fs_inode_bitmap inode_done_map = 0;
void e2fsck_pass3(e2fsck_t ctx)
{
ext2_filsys fs = ctx->fs;
- struct dir_info_iter *iter;
+ struct dir_info_iter *iter = NULL;
#ifdef RESOURCE_TRACK
struct resource_track rtrack;
#endif
@@ -108,7 +108,6 @@ void e2fsck_pass3(e2fsck_t ctx)
if (check_directory(ctx, dir->ino, &pctx))
goto abort_exit;
}
- e2fsck_dir_info_iter_end(ctx, iter);
/*
* Force the creation of /lost+found if not present
@@ -123,6 +122,8 @@ void e2fsck_pass3(e2fsck_t ctx)
e2fsck_rehash_directories(ctx);
abort_exit:
+ if (iter)
+ e2fsck_dir_info_iter_end(ctx, iter);
e2fsck_free_dir_info(ctx);
if (inode_loop_detect) {
ext2fs_free_inode_bitmap(inode_loop_detect);