]> Pileus Git - ~andy/linux/commitdiff
Btrfs: fix possible memory leak in replace_path()
authorStefan Behrens <sbehrens@giantdisaster.de>
Wed, 8 May 2013 08:56:09 +0000 (08:56 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Sat, 18 May 2013 01:40:19 +0000 (21:40 -0400)
In replace_path(), if read_tree_block() fails, we cannot return
directly, we should free some allocated memory otherwise memory
leak happens.

Similar to Wang's "Btrfs: fix possible memory leak in the
find_parent_nodes()" patch, the current commit fixes an issue that
is related to the "Btrfs: fix all callers of read_tree_block"
commit.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/relocation.c

index 704a1b8d2a2bae870fcf678d27aa4601f6745011..5c5b8bb44ee50b4f44ded8d43968a58fc7af1be7 100644 (file)
@@ -1773,7 +1773,7 @@ again:
                        if (!eb || !extent_buffer_uptodate(eb)) {
                                ret = (!eb) ? -ENOMEM : -EIO;
                                free_extent_buffer(eb);
-                               return ret;
+                               break;
                        }
                        btrfs_tree_lock(eb);
                        if (cow) {