summaryrefslogtreecommitdiff
path: root/e2fsck
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2006-05-14 17:16:29 -0400
committerTheodore Ts'o <tytso@mit.edu>2006-05-14 17:16:29 -0400
commit2aa362f54a9a486ffd495028b95532897551d619 (patch)
treeea493837c88222df006fb798ec353bb94b1cc184 /e2fsck
parent46c5490d13eef1a80634995fd52fd35a2ff55e7f (diff)
downloade2fsprogs-2aa362f54a9a486ffd495028b95532897551d619.tar.gz
Fix memory leak in e2fsck's error paths
Add missing brelse() calls to avoid memory leaks in error paths. (Thanks to Michael C. Thompson for pointing these out; they were originally found using Coverity.) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck')
-rw-r--r--e2fsck/ChangeLog7
-rw-r--r--e2fsck/journal.c4
-rw-r--r--e2fsck/recovery.c1
3 files changed, 11 insertions, 1 deletions
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 2107b71e..7da142ef 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-14 Theodore Tso <tytso@mit.edu>
+
+ * recovery.c (do_one_pass), journal.c (e2fsck_get_journal): Add
+ missing brelse() calls to avoid memory leaks in error
+ paths. (Thanks to Michael C. Thompson for pointing these
+ out; they were originally found using Coverity.)
+
2006-05-13 Theodore Tso <tytso@mit.edu>
* badblocks.c (read_bad_blocks_file): Pass the private option -X
diff --git a/e2fsck/journal.c b/e2fsck/journal.c
index a5ebe142..0cb14d3a 100644
--- a/e2fsck/journal.c
+++ b/e2fsck/journal.c
@@ -344,8 +344,10 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal)
goto errout;
}
ll_rw_block(READ, 1, &bh);
- if ((retval = bh->b_err) != 0)
+ if ((retval = bh->b_err) != 0) {
+ brelse(bh);
goto errout;
+ }
memcpy(&jsuper, start ? bh->b_data : bh->b_data + 1024,
sizeof(jsuper));
brelse(bh);
diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c
index d25dd98c..36e5e2bb 100644
--- a/e2fsck/recovery.c
+++ b/e2fsck/recovery.c
@@ -526,6 +526,7 @@ static int do_one_pass(journal_t *journal,
default:
jbd_debug(3, "Unrecognised magic %d, end of scan.\n",
blocktype);
+ brelse(bh);
goto done;
}
}