Skip to content

Commit c16c2e2

Browse files
Wang ShilongJosef Bacik
authored andcommitted
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: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
1 parent 4968810 commit c16c2e2

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎fs/btrfs/backref.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
918918
ref->parent, bsz, 0);
919919
if (!eb || !extent_buffer_uptodate(eb)) {
920920
free_extent_buffer(eb);
921-
return -EIO;
921+
ret = -EIO;
922+
goto out;
922923
}
923924
ret = find_extent_in_eb(eb, bytenr,
924925
*extent_item_pos, &eie);

0 commit comments

Comments
 (0)