From: Tsutomu Itoh Date: Wed, 9 Apr 2014 00:18:04 +0000 (+0900) Subject: Btrfs: fix possible memory leak in btrfs_create_tree() X-Git-Tag: v4.9.8~6070^2~92 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=59885b39303edc0b3284f324a1ca42cb6e7742d0;p=platform%2Fkernel%2Flinux-rpi3.git 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 Signed-off-by: Tsutomu Itoh Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index cf8427a..d3bd34e 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -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);