btrfs-progs: fix memory leak in cmd_qgroup_show()

filter_set and comparer_set should be freed on return.

Signed-off-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
master
Eryu Guan 2015-10-19 19:37:59 +08:00 committed by David Sterba
parent ae71f1cf53
commit 1669d8afa6
2 changed files with 5 additions and 1 deletions

View File

@ -348,8 +348,11 @@ static int cmd_qgroup_show(int argc, char **argv)
path = argv[optind];
fd = btrfs_open_dir(path, &dirstream, 1);
if (fd < 0)
if (fd < 0) {
btrfs_qgroup_free_filter_set(filter_set);
btrfs_qgroup_free_comparer_set(comparer_set);
return 1;
}
if (filter_flag) {
qgroupid = btrfs_get_path_rootid(fd);

View File

@ -1208,6 +1208,7 @@ int btrfs_show_qgroups(int fd,
__free_all_qgroups(&qgroup_lookup);
btrfs_qgroup_free_filter_set(filter_set);
btrfs_qgroup_free_comparer_set(comp_set);
return ret;
}