Skip to content

Commit

Permalink
Btrfs: fix possible memory leak in the find_parent_nodes()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wang Shilong authored and Josef Bacik committed May 18, 2013
1 parent 4968810 commit c16c2e2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/btrfs/backref.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
ref->parent, bsz, 0);
if (!eb || !extent_buffer_uptodate(eb)) {
free_extent_buffer(eb);
return -EIO;
ret = -EIO;
goto out;
}
ret = find_extent_in_eb(eb, bytenr,
*extent_item_pos, &eie);
Expand Down

0 comments on commit c16c2e2

Please sign in to comment.