]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix ulist leaks in error paths of qgroup self tests
authorFilipe Manana <fdmanana@suse.com>
Tue, 1 Nov 2022 16:15:39 +0000 (16:15 +0000)
committerDavid Sterba <dsterba@suse.com>
Wed, 2 Nov 2022 16:43:32 +0000 (17:43 +0100)
commit07c4d4f668132368c4ac47c279f0a686d3de3956
treef619c06089fd78827eb4b5ca577b7438a2c1050d
parent170b52591d46090c375bdc28cbb9c10167a2e36f
btrfs: fix ulist leaks in error paths of qgroup self tests

In the test_no_shared_qgroup() and test_multiple_refs() qgroup self tests,
if we fail to add the tree ref, remove the extent item or remove the
extent ref, we are returning from the test function without freeing the
"old_roots" ulist that was allocated by the previous calls to
btrfs_find_all_roots(). Fix that by calling ulist_free() before returning.

Fixes: 478952a2de0e ("btrfs: qgroup: Switch self test to extent-oriented qgroup mechanism.")
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tests/qgroup-tests.c