Skip to contentSkip to conversation

sh: fix seq_file memory leak

PATCH In review Li Zefan 2 participants 2 messages Jun 24, 2008 SuperH

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 sh: fix seq_file memory leak

When using single_open(), single_release() should be used instead of seq_release(), otherwise there is a memory leak.

---
 arch/sh/mm/cache-debugfs.c |    2 +-
 arch/sh/mm/pmb.c           |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/sh/mm/cache-debugfs.c +1 -1
index c5b56d5..0e189cc 100644
@@ -120,7 +120,7 @@ static const struct file_operations cache_debugfs_fops = {
 	.open		= cache_debugfs_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
-	.release	= seq_release,
+	.release	= single_release,
 };
 
 static int __init cache_debugfs_init(void)
arch/sh/mm/pmb.c +1 -1
index 0b0ec6e..95653e2 100644
@@ -385,7 +385,7 @@ static const struct file_operations pmb_debugfs_fops = {
 	.open		= pmb_debugfs_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
-	.release	= seq_release,
+	.release	= single_release,
 };
 
 static int __init pmb_debugfs_init(void)
Signature · 1 line
1.5.4.rc3
#1 lore raw
Quoted 4 lines · Li Zefan

When using single_open(), single_release() should be used instead of seq_release(), otherwise there is a memory leak.

Good catch. Applied, thanks.