fs/ntfs3: Avoid possible memory leak
authorSu Hui <suhui@nfschina.com>
Mon, 25 Sep 2023 04:48:07 +0000 (12:48 +0800)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Thu, 28 Sep 2023 12:04:06 +0000 (15:04 +0300)
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>
fs/ntfs3/fslog.c

index 12f28cd..98ccb66 100644 (file)
@@ -2168,8 +2168,10 @@ file_is_valid:
 
                        if (!page) {
                                page = kmalloc(log->page_size, GFP_NOFS);
-                               if (!page)
-                                       return -ENOMEM;
+                               if (!page) {
+                                       err = -ENOMEM;
+                                       goto out;
+                               }
                        }
 
                        /*