aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2015-10-22 11:53:39 +0800
committerDavid Sterba <dsterba@suse.com>2015-11-02 09:35:06 +0100
commit0c90ac0872594d3f6abfa4a91c5c68bd50ad4472 (patch)
tree1bb0e8c396314aaaedd2dc6d7f183c6ee931464e /cmds-filesystem.c
parent1fcb190793b55317463cf1674a3d0bb2f00fe4d7 (diff)
downloadbtrfs-progs-0c90ac0872594d3f6abfa4a91c5c68bd50ad4472.tar.gz
btrfs-progs-0c90ac0872594d3f6abfa4a91c5c68bd50ad4472.tar.xz
btrfs-progs-0c90ac0872594d3f6abfa4a91c5c68bd50ad4472.zip
btrfs-progs: fix uninitialized copy of btrfs_fs_devices list
Noticed that at print_one_uuid() some of the members of btrfs_fs_devices contained some junk values. It took a while to dig this further, and found that we make a local copy of the btrfs_fs_devices list at search_umounted_fs_uuids() and wasn't initialized properly. Fixed using using calloc instead of malloc. Signed-off-by: Anand Jain <anand.jain@oracle.com> [ switched to calloc ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 91bf1fa..819daa1 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -684,7 +684,7 @@ static int search_umounted_fs_uuids(struct list_head *all_uuids,
if (is_seen_fsid(cur_fs->fsid))
continue;
- fs_copy = malloc(sizeof(*fs_copy));
+ fs_copy = calloc(1, sizeof(*fs_copy));
if (!fs_copy) {
ret = -ENOMEM;
goto out;