Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59885b39 authored by Tsutomu Itoh's avatar Tsutomu Itoh Committed by Chris Mason
Browse files

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: default avatarAlex Lyakas <alex@zadarastorage.com>
Signed-off-by: default avatarTsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 776e4aae
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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);