Skip to content

Commit d737278

Browse files
Eric Sandeenmasoncl
authored andcommitted
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 <[email protected]> Signed-off-by: Chris Mason <[email protected]>
1 parent b050f9f commit d737278

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/btrfs/qgroup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1798,8 +1798,10 @@ static int qgroup_shared_accounting(struct btrfs_trans_handle *trans,
17981798
return -ENOMEM;
17991799

18001800
tmp = ulist_alloc(GFP_NOFS);
1801-
if (!tmp)
1801+
if (!tmp) {
1802+
ulist_free(qgroups);
18021803
return -ENOMEM;
1804+
}
18031805

18041806
btrfs_get_tree_mod_seq(fs_info, &elem);
18051807
ret = btrfs_find_all_roots(trans, fs_info, oper->bytenr, elem.seq,

0 commit comments

Comments
 (0)