Commit 9ca2e97f authored by Christophe JAILLET's avatar Christophe JAILLET Committed by David Sterba

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: default avatarQu Wenruo <quwenruo.btrfs@gmx.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent c434d21c
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment