Skip to content

Commit

Permalink
fs/ntfs3: Avoid possible memory leak
Browse files Browse the repository at this point in the history
[ Upstream commit e449477 ]

smatch warn:
fs/ntfs3/fslog.c:2172 last_log_lsn() warn: possible memory leak of 'page_bufs'
Jump to label 'out' to free 'page_bufs' and is more consistent with
other code.

Signed-off-by: Su Hui <suhui@nfschina.com>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Su Hui authored and gregkh committed Nov 8, 2023
1 parent b9ec0e7 commit 6777f23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/ntfs3/fslog.c
Original file line number Diff line number Diff line change
Expand Up @@ -2168,8 +2168,10 @@ static int last_log_lsn(struct ntfs_log *log)

if (!page) {
page = kmalloc(log->page_size, GFP_NOFS);
if (!page)
return -ENOMEM;
if (!page) {
err = -ENOMEM;
goto out;
}
}

/*
Expand Down

0 comments on commit 6777f23

Please sign in to comment.