summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEryu Guan <guaneryu@gmail.com>2015-10-19 19:37:59 +0800
committerDavid Sterba <dsterba@suse.com>2015-11-02 09:35:03 +0100
commit1669d8afa647c63a8a28669b9eadfb64ce98f3d7 (patch)
treeeb82eadaed1559671f44819da67ea9e9369b5f65
parentae71f1cf53eea91e480dc5f7c9e13338a7e1205c (diff)
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>
-rw-r--r--cmds-qgroup.c5
-rw-r--r--qgroup.c1
2 files changed, 5 insertions, 1 deletions
diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 0ad99f48..a64b7167 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -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);
diff --git a/qgroup.c b/qgroup.c
index 99fddead..1fbfcb97 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -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;
}