Btrfs: fix possible memory leak in btrfs_create_tree()

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>
This commit is contained in:
Tsutomu Itoh 2014-04-09 09:18:04 +09:00 committed by Chris Mason
parent 776e4aae55
commit 59885b3930

View file

@ -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);