btrfs: fix leak of path in btrfs_find_item
authorDavid Sterba <dsterba@suse.cz>
Fri, 2 Jan 2015 17:45:16 +0000 (18:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Mar 2015 22:43:32 +0000 (14:43 -0800)
commitf9e2ba638c32dff17ee6404e2c8245fd49d99b8b
treecc172062ecfb5921b43b0c3c6cde2e961a677230
parent74e42361fa3bc102647ad1e1ec7c21b747658843
btrfs: fix leak of path in btrfs_find_item

commit 381cf6587f8a8a8e981bc0c1aaaa8859b51dc756 upstream.

If btrfs_find_item is called with NULL path it allocates one locally but
does not free it. Affected paths are inserting an orphan item for a file
and for a subvol root.

Move the path allocation to the callers.

Fixes: 3f870c289900 ("btrfs: expand btrfs_find_item() to include find_orphan_item functionality")
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ctree.c
fs/btrfs/disk-io.c
fs/btrfs/tree-log.c