Fix: sessiond: null pointer dereference on initial evaluation of session
[lttng-tools.git] / src / bin / lttng-sessiond / notification-thread-events.cpp
index 43879c99fe8957d021e2dacbb2218997cd3c73d8..6fb691be59f91d54e3c9107731ee9ee560670e30 100644 (file)
@@ -1107,13 +1107,12 @@ int evaluate_session_condition(
        }
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
        {
        }
        case LTTNG_CONDITION_TYPE_SESSION_ROTATION_COMPLETED:
        {
-               const auto rotation_id = new_state ?
-                               new_state->rotation.id :
-                                     session_info->last_state_sample.rotation.id;
+               const auto& sample = new_state ? *new_state : session_info->last_state_sample;
+               const auto rotation_id = sample.rotation.id;
 
                /* Callee acquires a reference to location. */
                *evaluation = lttng_evaluation_session_rotation_completed_create(
 
                /* Callee acquires a reference to location. */
                *evaluation = lttng_evaluation_session_rotation_completed_create(
-                               rotation_id, new_state->rotation.location);
+                               rotation_id, sample.rotation.location);
                break;
        }
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
                break;
        }
        case LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE:
This page took 0.022921 seconds and 4 git commands to generate.