Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d3d1744 authored by Liu Bo's avatar Liu Bo Committed by Chris Mason
Browse files

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: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent fa7c1494
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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 "
			    "%Lu-%Lu\n", logical, logical+len, em->start,
			    em->start + em->len);
		free_extent_map(em);
		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, "
			   "found %Lu-%Lu\n", logical, em->start,
			   em->start + em->len);
		free_extent_map(em);
		return -EINVAL;
	}