Skip to content

Commit 009ca35

Browse files
fdmananakdave
authored andcommitted
btrfs: tests: fix chunk map leak after failure to add it to the tree
If we fail to add the chunk map to the fs mapping tree we exit test_rmap_block() without freeing the chunk map. Fix this by adding a call to btrfs_free_chunk_map() before exiting the test function if the call to btrfs_add_chunk_map() failed. Fixes: 7dc66ab ("btrfs: use a dedicated data structure for chunk maps") CC: [email protected] # 6.12+ Reviewed-by: Boris Burkov <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 0497dfb commit 009ca35

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/tests/extent-map-tests.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,7 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
10451045
ret = btrfs_add_chunk_map(fs_info, map);
10461046
if (ret) {
10471047
test_err("error adding chunk map to mapping tree");
1048+
btrfs_free_chunk_map(map);
10481049
goto out_free;
10491050
}
10501051

0 commit comments

Comments
 (0)