[patch] latency_hist: fix small memory leak

From: Dan Carpenter
Date: Mon Feb 22 2010 - 08:28:27 EST


index_ptr needs to be freed on the error path.

Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>

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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/