diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-07-23 05:29:11 +0200 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-07-23 15:53:23 +0200 |
commit | 87827111a5538633b18e5c641ced673c4c2bb6ce (patch) | |
tree | 46249db51a7f94e31948f48b07efbbbc5de3e7c3 /kernel/trace/ftrace.c | |
parent | trace_stack: Fix seqfile memory leak (diff) | |
download | linux-87827111a5538633b18e5c641ced673c4c2bb6ce.tar.xz linux-87827111a5538633b18e5c641ced673c4c2bb6ce.zip |
function-graph: Fix seqfile memory leak
Every time we cat set_graph_function, we leak memory allocated
by seq_open().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A67D907.2010500@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 4521c77d1a1a..1f3ec2afa511 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -2596,6 +2596,14 @@ ftrace_graph_open(struct inode *inode, struct file *file) } static int +ftrace_graph_release(struct inode *inode, struct file *file) +{ + if (file->f_mode & FMODE_READ) + seq_release(inode, file); + return 0; +} + +static int ftrace_set_func(unsigned long *array, int *idx, char *buffer) { struct dyn_ftrace *rec; @@ -2724,9 +2732,10 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, } static const struct file_operations ftrace_graph_fops = { - .open = ftrace_graph_open, - .read = seq_read, - .write = ftrace_graph_write, + .open = ftrace_graph_open, + .read = seq_read, + .write = ftrace_graph_write, + .release = ftrace_graph_release, }; #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ |