From 566190c494083c9a460fbcb9052b5143a14a6e56 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 24 Mar 2021 14:21:40 -0400 Subject: [PATCH] Fix: sessiond: agent: lazy creation of agent on removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When unregistering a trigger that was previously registered, the agent corresponding to the trigger's domain will already exist. It is superfluous to handle the case where it doesn't exist and it would only hide an internal error. Signed-off-by: Jérémie Galarneau Change-Id: Ifc6d14b74586af8423a70b3466e0a2c00491d3c3 --- src/bin/lttng-sessiond/cmd.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index e8fd3110e..90a011fd9 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -4513,16 +4513,11 @@ enum lttng_error_code synchronize_tracer_notifier_unregister( struct agent *agt = agent_find_by_event_notifier_domain( trigger_domain); - if (!agt) { - agt = agent_create(trigger_domain); - if (!agt) { - ret_code = LTTNG_ERR_NOMEM; - goto end_unlock_session_list; - } - - agent_add(agt, trigger_agents_ht_by_domain); - } - + /* + * This trigger was never registered in the first place. Calling + * this function under those circumstances is an internal error. + */ + assert(agt); ret_code = trigger_agent_disable(trigger, agt); if (ret_code != LTTNG_OK) { goto end_unlock_session_list; -- 2.34.1