summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2020-06-01 17:10:37 +0800
committerRichard Weinberger <richard@nod.at>2020-09-17 22:55:51 +0200
commit58f6e78a65f1fcbf732f60a7478ccc99873ff3ba (patch)
tree78910bf74c5aeb46c1eaf20164f970ba0fdf712e
parentf2aae745b82c842221f4f233051f9ac641790959 (diff)
downloadlinux-58f6e78a65f1fcbf732f60a7478ccc99873ff3ba.tar.gz
linux-58f6e78a65f1fcbf732f60a7478ccc99873ff3ba.tar.bz2
linux-58f6e78a65f1fcbf732f60a7478ccc99873ff3ba.zip
ubifs: dent: Fix some potential memory leaks while iterating entries
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>
-rw-r--r--fs/ubifs/debug.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 31288d8fa2ce..ebff43f8009c 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -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;
}