diff mbox

Btrfs: fix possible memory leak in btrfs_create_tree()

Message ID 201404090018.AA00003@WIN-R1VKH1IH438.jp.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Tsutomu Itoh April 9, 2014, 12:18 a.m. UTC
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>
---
 fs/btrfs/disk-io.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 6d1ac7d..a35d7fb 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1374,6 +1374,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);