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

Commit 7fab68e1 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman
Browse files

btrfs: tests: Fix a memory leak in error handling path in 'run_test()'




[ Upstream commit 9ca2e97fa3c3216200afe35a3b111ec51cc796d2 ]

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>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b7ada2c0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -501,7 +501,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);