ubifs: dent: Fix some potential memory leaks while iterating entries
authorZhihao Cheng <chengzhihao1@huawei.com>
Mon, 1 Jun 2020 09:10:37 +0000 (17:10 +0800)
committerRichard Weinberger <richard@nod.at>
Thu, 17 Sep 2020 20:55:51 +0000 (22:55 +0200)
Fix some potential memory leaks in error handling branches while
iterating dent entries. For example, function dbg_check_dir()
forgets to free pdent if it exists.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Cc: <stable@vger.kernel.org>
Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system")
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/debug.c

index 31288d8..ebff43f 100644 (file)
@@ -1123,6 +1123,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir)
                        err = PTR_ERR(dent);
                        if (err == -ENOENT)
                                break;
+                       kfree(pdent);
                        return err;
                }