From: Zhihao Cheng Date: Mon, 1 Jun 2020 09:10:37 +0000 (+0800) Subject: ubifs: dent: Fix some potential memory leaks while iterating entries X-Git-Tag: v4.4.242~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b37f532653e9805c069e663280324921bf3a1a2;p=thirdparty%2Fkernel%2Fstable.git ubifs: dent: Fix some potential memory leaks while iterating entries commit 58f6e78a65f1fcbf732f60a7478ccc99873ff3ba upstream. 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 Cc: Fixes: 1e51764a3c2ac05a2 ("UBIFS: add new flash file system") Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 595ca0debe117..09134a13a39ce 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -1125,6 +1125,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; }