mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 02:19:51 +00:00
Btrfs: fix memory leak of chunks' extent map
As we're hold a ref on looking up the extent map, we need to drop the ref before returning to callers. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
fa7c14947a
commit
7d3d1744f8
1 changed files with 2 additions and 0 deletions
|
@ -4488,6 +4488,7 @@ int btrfs_num_copies(struct btrfs_fs_info *fs_info, u64 logical, u64 len)
|
||||||
btrfs_crit(fs_info, "Invalid mapping for %Lu-%Lu, got "
|
btrfs_crit(fs_info, "Invalid mapping for %Lu-%Lu, got "
|
||||||
"%Lu-%Lu\n", logical, logical+len, em->start,
|
"%Lu-%Lu\n", logical, logical+len, em->start,
|
||||||
em->start + em->len);
|
em->start + em->len);
|
||||||
|
free_extent_map(em);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4668,6 +4669,7 @@ static int __btrfs_map_block(struct btrfs_fs_info *fs_info, int rw,
|
||||||
btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, "
|
btrfs_crit(fs_info, "found a bad mapping, wanted %Lu, "
|
||||||
"found %Lu-%Lu\n", logical, em->start,
|
"found %Lu-%Lu\n", logical, em->start,
|
||||||
em->start + em->len);
|
em->start + em->len);
|
||||||
|
free_extent_map(em);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue