ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
PATCH 1/1 ocfs2: free 'dummy_sc' in sc_fop_release() in case of memory leak
'sd->dbg_sock' is malloc in sc_common_open(), but not freed at the end of sc_fop_release().
Signed-off-by Jun Piao <[email protected]>
--- fs/ocfs2/cluster/netdebug.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/cluster/netdebug.c +1 -0
@@ -426,6 +426,7 @@ static int sc_fop_release(struct inode *inode, struct file *file)struct o2net_sock_container *dummy_sc = sd->dbg_sock;o2net_debug_del_sc (dummy_sc); +kfree (dummy_sc);return seq_release_private (inode, file); }
Quoted 4 lines · piaojun
'
sd->dbg_sock' is malloc insc_common_open(), but not freed at the end ofsc_fop_release().Signed-off-by Jun Piao <[email protected]>
Looks good.
Reviewed-by Joseph Qi <[email protected]>
Thanks,
Joseph
Quoted 16 lines
--- fs/ocfs2/cluster/netdebug.c | 1 + 1 file changed, 1 insertion(+)fs/ocfs2/cluster/netdebug.c +1
-0@@ -426,6 +426,7 @@ static int sc_fop_release(struct inode *inode, struct file *file)struct o2net_sock_container *dummy_sc = sd->dbg_sock;o2net_debug_del_sc (dummy_sc); +kfree (dummy_sc);return seq_release_private (inode, file); }