[PATCH 09/10] btrfs-progs: fix memory leak in cmd_qgroup_show()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



filter_set and comparer_set should be freed on return.

Signed-off-by: Eryu Guan <guaneryu@xxxxxxxxx>
---
 cmds-qgroup.c | 2 ++
 qgroup.c      | 1 +
 2 files changed, 3 insertions(+)

diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 48c1733..82bd2e2 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -354,6 +354,8 @@ static int cmd_qgroup_show(int argc, char **argv)
 	fd = open_file_or_dir(path, &dirstream);
 	if (fd < 0) {
 		fprintf(stderr, "ERROR: can't access '%s'\n", path);
+		btrfs_qgroup_free_filter_set(filter_set);
+		btrfs_qgroup_free_comparer_set(comparer_set);
 		return 1;
 	}
 
diff --git a/qgroup.c b/qgroup.c
index ec9a3ac..0272aa8 100644
--- a/qgroup.c
+++ b/qgroup.c
@@ -1211,6 +1211,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;
 }
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux