Skip to content

Commit

Permalink
Btrfs: fix possible memory leak in btrfs_create_tree()
Browse files Browse the repository at this point in the history
In btrfs_create_tree(), if btrfs_insert_root() fails, we should
free root->commit_root.

Reported-by: Alex Lyakas <alex@zadarastorage.com>
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
Tsutomu Itoh authored and Chris Mason committed Jun 10, 2014
1 parent 776e4aa commit 59885b3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/btrfs/disk-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
fail:
if (leaf) {
btrfs_tree_unlock(leaf);
free_extent_buffer(root->commit_root);
free_extent_buffer(leaf);
}
kfree(root);
Expand Down

0 comments on commit 59885b3

Please sign in to comment.