aboutsummaryrefslogtreecommitdiffstats
path: root/volumes.c
diff options
context:
space:
mode:
authorJustin Maggard <jmaggard10@gmail.com>2016-07-28 10:44:11 -0700
committerDavid Sterba <dsterba@suse.com>2016-07-29 15:04:54 +0200
commitc52762b4c6716a97a8b561e019efd7bef395ad2f (patch)
tree9ae6700d9435222089c6731c125ae94e594ec727 /volumes.c
parentaf1812090bf957cdbc3d2e49e3a2d68b2108a07d (diff)
downloadbtrfs-progs-c52762b4c6716a97a8b561e019efd7bef395ad2f.tar.gz
btrfs-progs-c52762b4c6716a97a8b561e019efd7bef395ad2f.tar.xz
btrfs-progs-c52762b4c6716a97a8b561e019efd7bef395ad2f.zip
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 <jmaggard@netgear.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/volumes.c b/volumes.c
index 26bf6c5..a356d74 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);
}
}