]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
btrfs: tests: Fix a memory leak in error handling path in 'run_test()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Sun, 10 Sep 2017 11:19:38 +0000 (13:19 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 30 Oct 2017 11:27:56 +0000 (12:27 +0100)
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>
fs/btrfs/tests/free-space-tree-tests.c

index 1458bb0ea124a3784403adf6196e9bd146098b0d..8444a018cca2925f50c64e075ca98691a353bef3 100644 (file)
@@ -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);