Commit 379cde74 authored by Stefan Behrens's avatar Stefan Behrens Committed by Josef Bacik

Btrfs: fix possible memory leak in replace_path()

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: default avatarStefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent c16c2e2e
...@@ -1773,7 +1773,7 @@ int replace_path(struct btrfs_trans_handle *trans, ...@@ -1773,7 +1773,7 @@ int replace_path(struct btrfs_trans_handle *trans,
if (!eb || !extent_buffer_uptodate(eb)) { if (!eb || !extent_buffer_uptodate(eb)) {
ret = (!eb) ? -ENOMEM : -EIO; ret = (!eb) ? -ENOMEM : -EIO;
free_extent_buffer(eb); free_extent_buffer(eb);
return ret; break;
} }
btrfs_tree_lock(eb); btrfs_tree_lock(eb);
if (cow) { if (cow) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment