xfs: add missing bmap cancel calls in error paths
If a failure occurs after the bmap free list is populated and before xfs_bmap_finish() completes successfully (which returns a partial list on failure), the bmap free list must be cancelled. Otherwise, the extent items on the list are never freed and a memory leak occurs. Several random error paths throughout the code suffer this problem. Fix these up such that xfs_bmap_cancel() is always called on error. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:

committed by
Dave Chinner

parent
146e54b71e
commit
d4a97a0422
@@ -5945,6 +5945,7 @@ xfs_bmap_split_extent(
|
||||
return xfs_trans_commit(tp);
|
||||
|
||||
out:
|
||||
xfs_bmap_cancel(&free_list);
|
||||
xfs_trans_cancel(tp);
|
||||
return error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user