[patch] latency_hist: fix small memory leak

Dan Carpenter
2010-02-22T13:27:43Z

index_ptr needs to be freed on the error path.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/kernel/trace/latency_hist.c b/kernel/trace/latency_hist.c
index b3b5ea2..8edc70c 100644
--- a/kernel/trace/latency_hist.c
+++ b/kernel/trace/latency_hist.c
@@ -204,8 +204,10 @@ static void *l_start(struct seq_file *m, loff_t *pos)
, my_hist->beyond_hist_bound_samples
, MAX_ENTRY_NUM, "samples");
}
- if (index >= MAX_ENTRY_NUM)
+ if (index >= MAX_ENTRY_NUM) {
+ kfree(index_ptr);
return NULL;
+ }

*index_ptr = index;
return index_ptr;