ext4 crypto: fix memleak in ext4_readdir()

When ext4_bread() fails, fname_crypto_str remains
allocated after return. Fix that.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
CC: Dmitry Monakhov <dmonakhov@virtuozzo.com>
Signed-off-by: Theodore Ts'o <tytso@google.com>
Change-Id: Id3fc6ad39f771a0dbcab0c46a2df4f29cdb398f0
Git-commit: 7bf19038854f2bda589db4224124dee11968cdf3
Git-repo: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
Signed-off-by: Andrey Markovytch <andreym@codeaurora.org>
This commit is contained in:
Kirill Tkhai 2016-09-07 10:03:16 +03:00 committed by Gerrit - the friendly Code Review server
parent 1a96d6dcbf
commit 92d978db31

View file

@ -163,8 +163,11 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
index, 1);
file->f_ra.prev_pos = (loff_t)index << PAGE_CACHE_SHIFT;
bh = ext4_bread(NULL, inode, map.m_lblk, 0);
if (IS_ERR(bh))
return PTR_ERR(bh);
if (IS_ERR(bh)) {
err = PTR_ERR(bh);
bh = NULL;
goto errout;
}
}
if (!bh) {