Fix: sessiond: fix memory leak in receive_lttng_trigger
[lttng-tools.git] / src / bin / lttng-sessiond / cmd.c
index e8fd3110e21c2cacb8fe8bd07c2cac5c26f6a9ee..73773bd137726c4f09cbd4508338f8b391ad8583 100644 (file)
@@ -4360,7 +4360,7 @@ enum lttng_error_code synchronize_tracer_notifier_register(
                                goto end_unlock_session_list;
                        }
 
-                       agent_add(agt, trigger_agents_ht_by_domain);
+                       agent_add(agt, the_trigger_agents_ht_by_domain);
                }
 
                ret_code = trigger_agent_enable(trigger, agt);
@@ -4501,6 +4501,10 @@ enum lttng_error_code synchronize_tracer_notifier_unregister(
        switch (trigger_domain) {
        case LTTNG_DOMAIN_KERNEL:
                ret_code = kernel_unregister_event_notifier(trigger);
+               if (ret_code != LTTNG_OK) {
+                       goto end_unlock_session_list;
+               }
+
                break;
        case LTTNG_DOMAIN_UST:
                ust_app_global_update_all_event_notifier_rules();
@@ -4513,16 +4517,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;
@@ -5321,8 +5320,8 @@ int cmd_rotate_session(struct ltt_session *session,
        chunk_being_archived = NULL;
        if (!quiet_rotation) {
                ret = notification_thread_command_session_rotation_ongoing(
-                               notification_thread_handle,
-                               session->name, session->uid, session->gid,
+                               the_notification_thread_handle, session->name,
+                               session->uid, session->gid,
                                ongoing_rotation_chunk_id);
                if (ret != LTTNG_OK) {
                        ERR("Failed to notify notification thread that a session rotation is ongoing for session %s",
This page took 0.025671 seconds and 4 git commands to generate.