When quota disabled, btrfs qgroup show exit with a error message,
but the allocated memory is not freed.

By the way, this bug marked as issue#20 in github.

Signed-off-by: Gu Jinxiang <g...@cn.fujitsu.com>
---
 cmds-qgroup.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cmds-qgroup.c b/cmds-qgroup.c
index 38382ea9..5fbfaa17 100644
--- a/cmds-qgroup.c
+++ b/cmds-qgroup.c
@@ -369,9 +369,8 @@ static int cmd_qgroup_show(int argc, char **argv)
        path = argv[optind];
        fd = btrfs_open_dir(path, &dirstream, 1);
        if (fd < 0) {
-               free(filter_set);
-               free(comparer_set);
-               return 1;
+               ret = 1;
+               goto out;
        }
 
        if (sync) {
@@ -406,6 +405,10 @@ static int cmd_qgroup_show(int argc, char **argv)
        close_file_or_dir(fd, dirstream);
 
 out:
+       if (filter_set)
+               free(filter_set);
+       if (comparer_set)
+               free(comparer_set);
        return !!ret;
 }
 
-- 
2.14.1



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

Reply via email to