lkml.org 
[lkml]   [2009]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC][PATCH 03/11] ftrace: fix memory leak
Don't return after an allocation without freeing -- fix it by moving the check
up a few lines.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
kernel/trace/trace_events.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Index: linux-2.6/kernel/trace/trace_events.c
===================================================================
--- linux-2.6.orig/kernel/trace/trace_events.c
+++ linux-2.6/kernel/trace/trace_events.c
@@ -380,15 +380,15 @@ event_format_read(struct file *filp, cha
char *buf;
int r;

+ if (*ppos)
+ return 0;
+
s = kmalloc(sizeof(*s), GFP_KERNEL);
if (!s)
return -ENOMEM;

trace_seq_init(s);

- if (*ppos)
- return 0;
-
/* If any of the first writes fail, so will the show_format. */

trace_seq_printf(s, "name: %s\n", call->name);
--



\
 
 \ /
  Last update: 2009-03-17 23:11    [W:0.245 / U:0.816 seconds]
©2003-2014 Jasper Spaans. hosted at Digital Ocean