From: Jérémie Galarneau Date: Mon, 21 Sep 2015 20:38:01 +0000 (-0400) Subject: Fix: Break out of loop when searching for a domain's agent X-Git-Tag: v2.8.0-rc1~311 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1dfd9906a04873e9d381bf559eb8551c203c8a2a;p=lttng-tools.git Fix: Break out of loop when searching for a domain's agent The list command never check if a domain's agent has been found and lists the events of every agent. This has two direct effects: 1) Memory leak of all agents' event descriptions, except the last 2) The session daemon lists the wrong agent's events This fix check the agent's domain and breaks out of the loop once one is found. Fixes #906 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 7878a053c..b1d986393 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -2764,7 +2764,11 @@ ssize_t cmd_list_events(enum lttng_domain_type domain, rcu_read_lock(); cds_lfht_for_each_entry(session->ust_session->agents->ht, &iter.iter, agt, node.node) { - nb_event = list_lttng_agent_events(agt, events); + if (agt->domain == domain) { + nb_event = list_lttng_agent_events( + agt, events); + break; + } } rcu_read_unlock(); }