linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf svghelper: fix memory leak in svg_build_topology_map
@ 2020-06-03  3:00 Li Bin
  0 siblings, 0 replies; only message in thread
From: Li Bin @ 2020-06-03  3:00 UTC (permalink / raw)
  To: acme, linux-kernel; +Cc: liwei391, xiexiuqi, huawei.libin

Fix leak of memory pointed to by t.sib_thr and t.sib_core in
svg_build_topology_map in the non-error path.

Signed-off-by: Li Bin <huawei.libin@huawei.com>
---
 tools/perf/util/svghelper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c
index 96f941e..d50955f 100644
--- a/tools/perf/util/svghelper.c
+++ b/tools/perf/util/svghelper.c
@@ -754,6 +754,7 @@ int svg_build_topology_map(struct perf_env *env)
 	int i, nr_cpus;
 	struct topology t;
 	char *sib_core, *sib_thr;
+	int ret = -1;
 
 	nr_cpus = min(env->nr_cpus_online, MAX_NR_CPUS);
 
@@ -798,12 +799,11 @@ int svg_build_topology_map(struct perf_env *env)
 		topology_map[i] = -1;
 
 	scan_core_topology(topology_map, &t, nr_cpus);
-
-	return 0;
+	ret = 0;
 
 exit:
 	zfree(&t.sib_core);
 	zfree(&t.sib_thr);
 
-	return -1;
+	return ret;
 }
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-03  3:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-03  3:00 [PATCH] perf svghelper: fix memory leak in svg_build_topology_map Li Bin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).