btrfs: tests: Fix a memory leak in error handling path in 'run_test()'
If 'btrfs_alloc_path()' fails, we must free the resources already allocated, as done in the other error handling paths in this function. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Reviewed-by: Qu Wenruo <quwenruo.btrfs@gmx.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c434d21c64
commit
9ca2e97fa3
1 changed files with 2 additions and 1 deletions
|
@ -500,7 +500,8 @@ static int run_test(test_func_t test_func, int bitmaps, u32 sectorsize,
|
|||
path = btrfs_alloc_path();
|
||||
if (!path) {
|
||||
test_msg("Couldn't allocate path\n");
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = add_block_group_free_space(&trans, root->fs_info, cache);
|
||||
|
|
Loading…
Reference in a new issue