提交 a6579cbf 编写于 作者: C Colin Ian King 提交者: Andreas Gruenbacher

gfs2: Fix memory leak of object lsi on error return path

In the case where IS_ERR(lsi->si_sc_inode) is true the error exit path
to free_local does not kfree the allocated object lsi leading to a memory
leak. Fix this by kfree'ing lst before taking the error exit path.

Addresses-Coverity: ("Resource leak")
Fixes: 97fd734b ("gfs2: lookup local statfs inodes prior to journal recovery")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NAndreas Gruenbacher <agruenba@redhat.com>
上级 2734d6c1
......@@ -677,6 +677,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
error = PTR_ERR(lsi->si_sc_inode);
fs_err(sdp, "can't find local \"sc\" file#%u: %d\n",
jd->jd_jid, error);
kfree(lsi);
goto free_local;
}
lsi->si_jid = jd->jd_jid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册