[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20230925044807.92037-2-suhui@nfschina.com>
Date: Mon, 25 Sep 2023 12:48:07 +0800
From: Su Hui <suhui@...china.com>
To: almaz.alexandrovich@...agon-software.com
Cc: Su Hui <suhui@...china.com>, ntfs3@...ts.linux.dev,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH 2/2] fs/ntfs3: Avoid possible memory leak
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@...china.com>
---
fs/ntfs3/fslog.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index 12f28cdf5c83..98ccb6650858 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -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;
+ }
}
/*
--
2.30.2
Powered by blists - more mailing lists