[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <73307f566b55e402a7e955d43c4cf80a42fb3014.1389305623.git.yangds.fnst@cn.fujitsu.com>
Date: Thu, 9 Jan 2014 17:19:52 -0500
From: Dongsheng Yang <yangds.fnst@...fujitsu.com>
To: linux-kernel@...r.kernel.org, acme@...hat.com
Cc: dsahern@...il.com, artagnon@...il.com,
Dongsheng Yang <yangds.fnst@...fujitsu.com>
Subject: [PATCH 2/7] perf tools: free aliases[j] in pmu.c if name_only is true.
As aliases is a 2-D array malloced in function print_pmu_events(),
we should free it after printf. But we just did it when (!name_only).
This patch fix the leak error in print_pmu_events() when name_only
is true.
Signed-off-by: Dongsheng Yang <yangds.fnst@...fujitsu.com>
---
tools/perf/util/pmu.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 331dc2c..169c480 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -752,6 +752,7 @@ unsigned int print_pmu_events(const char *event_glob, bool name_only)
for (j = 0; j < len; j++) {
if (name_only) {
printf("%s ", aliases[j]);
+ zfree(&aliases[j]);
count++;
continue;
}
--
1.8.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists