btrfs-progs: don't access freed memory in btrfs_close_devices

Caught by ASAN, as we don't access fs_devices directly, there's no null
deref but 0x30 is still wrong.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2016-10-03 16:48:53 +02:00
parent 61d5425fd3
commit ea0fd88b5a
1 changed files with 2 additions and 0 deletions

View File

@ -162,6 +162,8 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
struct btrfs_device *device;
again:
if (!fs_devices)
return 0;
while (!list_empty(&fs_devices->devices)) {
device = list_entry(fs_devices->devices.next,
struct btrfs_device, dev_list);