Skip to content

Commit 35d99c6

Browse files
Haoxiang Likdave
authored andcommitted
btrfs: fix a leaked chunk map issue in read_one_chunk()
Add btrfs_free_chunk_map() to free the memory allocated by btrfs_alloc_chunk_map() if btrfs_add_chunk_map() fails. Fixes: 7dc66ab ("btrfs: use a dedicated data structure for chunk maps") CC: stable@vger.kernel.org Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 2df2c6e commit 35d99c6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/volumes.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7151,6 +7151,7 @@ static int read_one_chunk(struct btrfs_key *key, struct extent_buffer *leaf,
71517151
btrfs_err(fs_info,
71527152
"failed to add chunk map, start=%llu len=%llu: %d",
71537153
map->start, map->chunk_len, ret);
7154+
btrfs_free_chunk_map(map);
71547155
}
71557156

71567157
return ret;

0 commit comments

Comments
 (0)