Fix: Break out of loop when searching for a domain's agent
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 21 Sep 2015 20:38:01 +0000 (16:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 21 Sep 2015 21:17:54 +0000 (17:17 -0400)
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 <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c

index 660cd0ca8f1bea97aacebead6da8b1acd14f352e..4391b6a58c354c6445a8195c345bc7eb91b3a561 100644 (file)
@@ -2748,7 +2748,11 @@ ssize_t cmd_list_events(int domain, struct ltt_session *session,
                        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();
                }
This page took 0.031278 seconds and 4 git commands to generate.