diff options
author | Eric Sandeen <sandeen@redhat.com> | 2014-08-17 16:09:21 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-08-21 10:55:29 -0400 |
commit | a3c108950d8e0bfcf48856cc159956022a7ad925 (patch) | |
tree | e158d7b90824bea47a772c2386487aec62a2de3b /fs | |
parent | 51f395ad4058883e4273b02fdebe98072dbdc0d2 (diff) |
btrfs: fix leak in qgroup_subtree_accounting() error path
Coverity pointed this out; in the newly added
qgroup_subtree_accounting(), if btrfs_find_all_roots()
returns an error, we leak at least the parents pointer,
and possibly the roots pointer, depending on what failure
occurs.
If btrfs_find_all_roots() returns an error, we need to
free up all allocations before we return. "roots" is
initialized to NULL, so it should be safe to free
it unconditionally (ulist_free() handles that case).
Cc: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/qgroup.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index b497498484be..8abe45524de9 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1973,7 +1973,7 @@ static int qgroup_subtree_accounting(struct btrfs_trans_handle *trans, | |||
1973 | elem.seq, &roots); | 1973 | elem.seq, &roots); |
1974 | btrfs_put_tree_mod_seq(fs_info, &elem); | 1974 | btrfs_put_tree_mod_seq(fs_info, &elem); |
1975 | if (ret < 0) | 1975 | if (ret < 0) |
1976 | return ret; | 1976 | goto out; |
1977 | 1977 | ||
1978 | if (roots->nnodes != 1) | 1978 | if (roots->nnodes != 1) |
1979 | goto out; | 1979 | goto out; |