Skip to content

Commit a6579cb

Browse files
Colin Ian KingAndreas Gruenbacher
authored andcommitted
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: 97fd734 ("gfs2: lookup local statfs inodes prior to journal recovery") Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 2734d6c commit a6579cb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/gfs2/ops_fstype.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ static int init_statfs(struct gfs2_sbd *sdp)
677677
error = PTR_ERR(lsi->si_sc_inode);
678678
fs_err(sdp, "can't find local \"sc\" file#%u: %d\n",
679679
jd->jd_jid, error);
680+
kfree(lsi);
680681
goto free_local;
681682
}
682683
lsi->si_jid = jd->jd_jid;

0 commit comments

Comments
 (0)