提交 c16c2e2e 编写于 作者: W Wang Shilong 提交者: 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: NWang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册