Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d6643d12cb0885d06a1491b16c1476abcbd53d40
Commit:     d6643d12cb0885d06a1491b16c1476abcbd53d40
Parent:     ae0027869db7d28563cd783865fab04ffd18419c
Author:     Hiroshi Shimamoto <[EMAIL PROTECTED]>
AuthorDate: Thu Feb 14 10:27:00 2008 -0800
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Feb 25 16:34:17 2008 +0100

    latencytop: fix memory leak on latency proc file
    
    At lstats_open(), calling get_proc_task() gets task struct, but it never 
put.
    put_task_struct() should be called when releasing.
    
    Signed-off-by: Hiroshi Shimamoto <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
---
 fs/proc/base.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 989e307..85e06e4 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -360,6 +360,15 @@ static int lstats_open(struct inode *inode, struct file 
*file)
        return ret;
 }
 
+static int lstats_release(struct inode *inode, struct file *file)
+{
+       struct seq_file *m = file->private_data;
+       struct task_struct *task = m->private;
+
+       put_task_struct(task);
+       return single_release(inode, file);
+}
+
 static ssize_t lstats_write(struct file *file, const char __user *buf,
                            size_t count, loff_t *offs)
 {
@@ -378,7 +387,7 @@ static const struct file_operations proc_lstats_operations 
= {
        .read           = seq_read,
        .write          = lstats_write,
        .llseek         = seq_lseek,
-       .release        = single_release,
+       .release        = lstats_release,
 };
 
 #endif
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to