linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf_counter tools: Fix memory leaks of add_cmdname()
@ 2021-11-19  8:46 Sohaib Mohamed
  2021-11-25 21:38 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Sohaib Mohamed @ 2021-11-19  8:46 UTC (permalink / raw)
  Cc: sohaib.amhmd, irogers, acme, linux-perf-users, Ingo Molnar,
	linux-kernel

ASan reports some memory leaks when running:

$ perf xyz

This patch adds the missing clean_cmdnames()

Fixes: 078006012401 ("perf_counter tools: add in basic glue from Git")

Signed-off-by: Sohaib Mohamed <sohaib.amhmd@gmail.com>
---
 tools/lib/subcmd/help.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/subcmd/help.c b/tools/lib/subcmd/help.c
index bf02d62a3b2b..4a433f4d19a1 100644
--- a/tools/lib/subcmd/help.c
+++ b/tools/lib/subcmd/help.c
@@ -187,6 +187,7 @@ static void list_commands_in_dir(struct cmdnames *cmds,
 
 		add_cmdname(cmds, de->d_name + prefix_len, entlen);
 	}
+	clean_cmdnames(cmds);
 	closedir(dir);
 	free(buf);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-25 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-19  8:46 [PATCH] perf_counter tools: Fix memory leaks of add_cmdname() Sohaib Mohamed
2021-11-25 21:38 ` Arnaldo Carvalho de Melo

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).