ubifs: ubifs_jnl_write_inode: Fix a memory leak bug
authorZhihao Cheng <chengzhihao1@huawei.com>
Tue, 3 Mar 2020 09:40:22 +0000 (17:40 +0800)
committerRichard Weinberger <richard@nod.at>
Mon, 30 Mar 2020 21:00:36 +0000 (23:00 +0200)
When inodes with extended attributes are evicted, xent is not freed in one
exit branch.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Fixes: 9ca2d732644484488db3112 ("ubifs: Limit number of xattrs per inode")
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/journal.c

index 3bf8b1f..e5ec1af 100644 (file)
@@ -905,6 +905,7 @@ int ubifs_jnl_write_inode(struct ubifs_info *c, const struct inode *inode)
                                ubifs_err(c, "dead directory entry '%s', error %d",
                                          xent->name, err);
                                ubifs_ro_mode(c, err);
+                               kfree(xent);
                                goto out_release;
                        }
                        ubifs_assert(c, ubifs_inode(xino)->xattr);