consumer_output_put(session->consumer);
snapshot_destroy(&session->snapshot);
- ASSERT_LOCKED(ltt_session_list.lock);
- del_session_list(session);
- del_session_ht(session);
- pthread_cond_broadcast(<t_session_list.removal_cond);
+ if (session->published) {
+ ASSERT_LOCKED(ltt_session_list.lock);
+ del_session_list(session);
+ del_session_ht(session);
+ pthread_cond_broadcast(<t_session_list.removal_cond);
+ }
free(session);
}
* by session id.
*/
add_session_ht(new_session);
+ new_session->published = true;
session_unlock_list();
/*
error:
error_asprintf:
- free(new_session);
+ session_lock_list();
+ session_put(new_session);
+ session_unlock_list();
error_malloc:
return ret;
pthread_mutex_t lock;
struct cds_list_head list;
uint64_t id; /* session unique identifier */
+ /* Indicates if the session has been added to the session list and ht.*/
+ bool published;
/* Indicates if a destroy command has been applied to this session. */
bool destroyed;
/* UID/GID of the user owning the session */
struct lttng_ht_iter iter;
struct snapshot_output *output;
- assert(obj);
+ if (!obj->output_ht) {
+ return;
+ }
rcu_read_lock();
cds_lfht_for_each_entry(obj->output_ht->ht, &iter.iter, output,