From c52762b4c6716a97a8b561e019efd7bef395ad2f Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Thu, 28 Jul 2016 10:44:11 -0700 Subject: btrfs-progs: fix memory leak with missing device In read_one_chunk(), we may add an empty entry for a missing device. However, this entry wasn't being added to the dev_list, and so it never got freed. Signed-off-by: Justin Maggard Signed-off-by: David Sterba --- volumes.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'volumes.c') diff --git a/volumes.c b/volumes.c index 26bf6c54..a356d740 100644 --- a/volumes.c +++ b/volumes.c @@ -1761,6 +1761,8 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key, map->stripes[i].dev = fill_missing_device(devid); printf("warning, device %llu is missing\n", (unsigned long long)devid); + list_add(&map->stripes[i].dev->dev_list, + &root->fs_info->fs_devices->devices); } } -- cgit v1.2.3