Commit c16c2e2e authored by Wang Shilong's avatar Wang Shilong Committed by Josef Bacik

Btrfs: fix possible memory leak in the find_parent_nodes()

In the find_parent_nodes(), if read_tree_block() fails, we can
not return directly, we should free some allocated memory otherwise
memory leak happens.
Signed-off-by: default avatarWang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent 49688107
...@@ -918,7 +918,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, ...@@ -918,7 +918,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
ref->parent, bsz, 0); ref->parent, bsz, 0);
if (!eb || !extent_buffer_uptodate(eb)) { if (!eb || !extent_buffer_uptodate(eb)) {
free_extent_buffer(eb); free_extent_buffer(eb);
return -EIO; ret = -EIO;
goto out;
} }
ret = find_extent_in_eb(eb, bytenr, ret = find_extent_in_eb(eb, bytenr,
*extent_item_pos, &eie); *extent_item_pos, &eie);
......
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