Skip to content

Commit 050552c

Browse files
committed
xfs: fix some memory leaks in log recovery
Fix a few places where we xlog_alloc_buffer a buffer, hit an error, and then bail out without freeing the buffer. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Brian Foster <[email protected]>
1 parent f368b29 commit 050552c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/xfs/xfs_log_recover.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,10 +1342,11 @@ xlog_find_tail(
13421342
error = xlog_rseek_logrec_hdr(log, *head_blk, *head_blk, 1, buffer,
13431343
&rhead_blk, &rhead, &wrapped);
13441344
if (error < 0)
1345-
return error;
1345+
goto done;
13461346
if (!error) {
13471347
xfs_warn(log->l_mp, "%s: couldn't find sync record", __func__);
1348-
return -EFSCORRUPTED;
1348+
error = -EFSCORRUPTED;
1349+
goto done;
13491350
}
13501351
*tail_blk = BLOCK_LSN(be64_to_cpu(rhead->h_tail_lsn));
13511352

@@ -5300,7 +5301,8 @@ xlog_do_recovery_pass(
53005301
} else {
53015302
XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW,
53025303
log->l_mp);
5303-
return -EFSCORRUPTED;
5304+
error = -EFSCORRUPTED;
5305+
goto bread_err1;
53045306
}
53055307
}
53065308

0 commit comments

Comments
 (0)