diff options
author | Eric Sandeen <sandeen@sandeen.net> | 2017-11-27 21:23:32 -0500 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-11-28 11:57:11 -0500 |
commit | d41c6172bd4031979eab722c265a2e5764383c3c (patch) | |
tree | 2d18e46cefdb44b649a1e60d4ab6e111c2eb5dfe | |
parent | d210a9874b8f6166579408131cb74495caff1958 (diff) |
xfs: fix leaks on corruption errors in xfs_bmap.c
Use _GOTO instead of _RETURN so we can free the allocated
cursor on error.
Fixes: bf80628 ("xfs: remove xfs_bmse_shift_one")
Fixes-coverity-id: 1423813, 1423676
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r-- | fs/xfs/libxfs/xfs_bmap.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 08df809e2315..1210f684d3c2 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c | |||
@@ -5662,7 +5662,8 @@ xfs_bmap_collapse_extents( | |||
5662 | *done = true; | 5662 | *done = true; |
5663 | goto del_cursor; | 5663 | goto del_cursor; |
5664 | } | 5664 | } |
5665 | XFS_WANT_CORRUPTED_RETURN(mp, !isnullstartblock(got.br_startblock)); | 5665 | XFS_WANT_CORRUPTED_GOTO(mp, !isnullstartblock(got.br_startblock), |
5666 | del_cursor); | ||
5666 | 5667 | ||
5667 | new_startoff = got.br_startoff - offset_shift_fsb; | 5668 | new_startoff = got.br_startoff - offset_shift_fsb; |
5668 | if (xfs_iext_peek_prev_extent(ifp, &icur, &prev)) { | 5669 | if (xfs_iext_peek_prev_extent(ifp, &icur, &prev)) { |
@@ -5767,7 +5768,8 @@ xfs_bmap_insert_extents( | |||
5767 | goto del_cursor; | 5768 | goto del_cursor; |
5768 | } | 5769 | } |
5769 | } | 5770 | } |
5770 | XFS_WANT_CORRUPTED_RETURN(mp, !isnullstartblock(got.br_startblock)); | 5771 | XFS_WANT_CORRUPTED_GOTO(mp, !isnullstartblock(got.br_startblock), |
5772 | del_cursor); | ||
5771 | 5773 | ||
5772 | if (stop_fsb >= got.br_startoff + got.br_blockcount) { | 5774 | if (stop_fsb >= got.br_startoff + got.br_blockcount) { |
5773 | error = -EIO; | 5775 | error = -EIO; |