diff options
author | Eric Sandeen <sandeen@redhat.com> | 2014-06-12 01:14:59 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-06-13 12:52:26 -0400 |
commit | d737278091fccda77f6896012ba86c5ffb57993f (patch) | |
tree | 41ccc9192cceeeaa0a8694b6c6d3a7e7fd71c43a /fs/btrfs | |
parent | b050f9f6ddefe5de9c130fda6493ccaacd5168ba (diff) |
btrfs: free ulist in qgroup_shared_accounting() error path
If tmp = ulist_alloc(GFP_NOFS) fails, we return without
freeing the previously allocated qgroups = ulist_alloc(GFP_NOFS)
and cause a memory leak.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/qgroup.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index cf5aead95a7f..98cb6b2630f9 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c | |||
@@ -1798,8 +1798,10 @@ static int qgroup_shared_accounting(struct btrfs_trans_handle *trans, | |||
1798 | return -ENOMEM; | 1798 | return -ENOMEM; |
1799 | 1799 | ||
1800 | tmp = ulist_alloc(GFP_NOFS); | 1800 | tmp = ulist_alloc(GFP_NOFS); |
1801 | if (!tmp) | 1801 | if (!tmp) { |
1802 | ulist_free(qgroups); | ||
1802 | return -ENOMEM; | 1803 | return -ENOMEM; |
1804 | } | ||
1803 | 1805 | ||
1804 | btrfs_get_tree_mod_seq(fs_info, &elem); | 1806 | btrfs_get_tree_mod_seq(fs_info, &elem); |
1805 | ret = btrfs_find_all_roots(trans, fs_info, oper->bytenr, elem.seq, | 1807 | ret = btrfs_find_all_roots(trans, fs_info, oper->bytenr, elem.seq, |