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

Commit 2bac325e authored by Filipe David Borba Manana's avatar Filipe David Borba Manana Committed by Chris Mason
Browse files

Btrfs: fix inode leak on kmalloc failure in tree-log.c



In tree-log.c:replay_one_name(), if memory allocation for
the name fails, ensure we iput the dir inode we got before
before we return.

Signed-off-by: default avatarFilipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
parent 116e0024
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1536,8 +1536,10 @@ static noinline int replay_one_name(struct btrfs_trans_handle *trans,

	name_len = btrfs_dir_name_len(eb, di);
	name = kmalloc(name_len, GFP_NOFS);
	if (!name)
		return -ENOMEM;
	if (!name) {
		ret = -ENOMEM;
		goto out;
	}

	log_type = btrfs_dir_type(eb, di);
	read_extent_buffer(eb, name, (unsigned long)(di + 1),