Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);