From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [patch] latency_hist: fix small memory leak Date: Mon, 22 Feb 2010 16:27:43 +0300 Message-ID: <20100222132743.GB5416@bicker> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: LKML , rt-users , Ingo Molnar , Steven Rostedt , Peter Zijlstra , Carsten Emde , Clark Williams , Frank Rowand , Robin Gareus , Gregory Haskins , Philippe Reynes , Fernando Lopez-Lezcano , Will Schmidt , Darren Hart , Jan Blunck , Sven-Thorsten Dietrich , Jon Masters , Mark Knecht , John Kacur , Nick Piggin To: Thomas Gleixner Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-rt-users.vger.kernel.org index_ptr needs to be freed on the error path. Signed-off-by: Dan Carpenter 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;