Skip to content

Commit

Permalink
Btrfs: fix possible memory leak in replace_path()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stefan Behrens authored and Josef Bacik committed May 18, 2013
1 parent c16c2e2 commit 379cde7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/relocation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ int replace_path(struct btrfs_trans_handle *trans,
if (!eb || !extent_buffer_uptodate(eb)) {
ret = (!eb) ? -ENOMEM : -EIO;
free_extent_buffer(eb);
return ret;
break;
}
btrfs_tree_lock(eb);
if (cow) {
Expand Down

0 comments on commit 379cde7

Please sign in to comment.