Commit 5eb56d25 authored by Ilya Dryomov's avatar Ilya Dryomov

Btrfs: fix memory leak in resolver code

init_ipath() allocates btrfs_data_container which is never freed.  Free
it in free_ipath() and nuke the comment for init_data_container() - we
can safely free it with kfree().
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent e4837f8f
...@@ -1342,12 +1342,6 @@ int paths_from_inode(u64 inum, struct inode_fs_paths *ipath) ...@@ -1342,12 +1342,6 @@ int paths_from_inode(u64 inum, struct inode_fs_paths *ipath)
inode_to_path, ipath); inode_to_path, ipath);
} }
/*
* allocates space to return multiple file system paths for an inode.
* total_bytes to allocate are passed, note that space usable for actual path
* information will be total_bytes - sizeof(struct inode_fs_paths).
* the returned pointer must be freed with free_ipath() in the end.
*/
struct btrfs_data_container *init_data_container(u32 total_bytes) struct btrfs_data_container *init_data_container(u32 total_bytes)
{ {
struct btrfs_data_container *data; struct btrfs_data_container *data;
...@@ -1403,5 +1397,6 @@ struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root, ...@@ -1403,5 +1397,6 @@ struct inode_fs_paths *init_ipath(s32 total_bytes, struct btrfs_root *fs_root,
void free_ipath(struct inode_fs_paths *ipath) void free_ipath(struct inode_fs_paths *ipath)
{ {
kfree(ipath->fspath);
kfree(ipath); kfree(ipath);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment