]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix leak in qgroup_subtree_accounting() error path
authorEric Sandeen <sandeen@redhat.com>
Sun, 17 Aug 2014 20:09:21 +0000 (15:09 -0500)
committerChris Mason <clm@fb.com>
Thu, 21 Aug 2014 14:55:29 +0000 (07:55 -0700)
commit7e786f236b081a83d7758b509d94343cae5e122f
treee158d7b90824bea47a772c2386487aec62a2de3b
parent5447c2f61d8278f0b0ccd8a69114b6828cce0165
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>
fs/btrfs/qgroup.c