trace-cmd listen: Free all memory used to set up a domain
The return manager of the function add_domain() is not used, and all the
data to setup the manager descripter is copied to allocated memory. The
original data passed in is not used. Free it, even if a manager is created.
The mgr variable can now be removed as we don't need to use it from the
caller of add_domain().
Thanks to valgrind for pointing out the extra memory.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
diff --git a/tracecmd/trace-listen.c b/tracecmd/trace-listen.c
index d8a8ce7..cd30b68 100644
--- a/tracecmd/trace-listen.c
+++ b/tracecmd/trace-listen.c
@@ -1850,7 +1850,6 @@
struct tracecmd_msg_handle *msg_handle;
enum tracecmd_msg_mngr_type type;
struct client_list *client;
- struct manager_list *mgr;
char *domain;
char *agent_fifo;
char **cpu_fifos;
@@ -1873,15 +1872,13 @@
if (ret < 0)
break;
- mgr = add_domain(domain, agent_fifo, cpu_fifos);
+ add_domain(domain, agent_fifo, cpu_fifos);
- if (!mgr) {
- free(domain);
- free(agent_fifo);
- for (i = 0; cpu_fifos && cpu_fifos[i]; i++)
- free(cpu_fifos[i]);
- free(cpu_fifos);
- }
+ for (i = 0; cpu_fifos && cpu_fifos[i]; i++)
+ free(cpu_fifos[i]);
+ free(cpu_fifos);
+ free(domain);
+ free(agent_fifo);
break;
case TRACECMD_MSG_MNG_GLIST: