diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2014-03-14 03:28:11 +0000 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-03-21 09:51:31 -0700 |
commit | 9d57509e99a65732e9905402b36ea8b8d591e541 (patch) | |
tree | 35e9b88051f6ab3df978ef21aea9244881bde078 /cmds-filesystem.c | |
parent | 64200e4453f0f23bef42919db7854b6e8ed2ceda (diff) |
btrfs-progs: Fix a memleak in btrfs_scan_one_device.
Valgrind reports memleak in btrfs_scan_one_device() about allocating
btrfs_device but on btrfs_close_devices() they are not reclaimed.
Although not a bug since after btrfs_close_devices() btrfs will exit so
memory will be reclaimed by system anyway, it's better to fix it anyway.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r-- | cmds-filesystem.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c index dfbb4f50..fbf2e10b 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -656,6 +656,12 @@ devs_only: if (search && !found) ret = 1; + while (!list_empty(all_uuids)) { + fs_devices = list_entry(all_uuids->next, + struct btrfs_fs_devices, list); + list_del(&fs_devices->list); + btrfs_close_devices(fs_devices); + } out: printf("%s\n", BTRFS_BUILD_VERSION); free_seen_fsid(); |