From: Jérémie Galarneau Date: Wed, 24 Mar 2021 18:21:40 +0000 (-0400) Subject: Fix: sessiond: agent: lazy creation of agent on removal X-Git-Tag: v2.13.0-rc1~187 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=566190c494083c9a460fbcb9052b5143a14a6e56;p=lttng-tools.git Fix: sessiond: agent: lazy creation of agent on removal 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 --- 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;