Since ltt_session objects within the session daemon are now
reference counted, it is more appropriate to release a reference
on error rather than calling free() directly in session_create().
The session_release() function also performs additional that can
be needed in some of the error paths of session_create().
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
consumer_output_put(session->consumer);
snapshot_destroy(&session->snapshot);
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);
+ }
* by session id.
*/
add_session_ht(new_session);
* by session id.
*/
add_session_ht(new_session);
+ new_session->published = true;
session_unlock_list();
/*
session_unlock_list();
/*
+ session_lock_list();
+ session_put(new_session);
+ session_unlock_list();
error_malloc:
return ret;
error_malloc:
return ret;
pthread_mutex_t lock;
struct cds_list_head list;
uint64_t id; /* session unique identifier */
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 */
/* 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;
struct lttng_ht_iter iter;
struct snapshot_output *output;
+ if (!obj->output_ht) {
+ return;
+ }
rcu_read_lock();
cds_lfht_for_each_entry(obj->output_ht->ht, &iter.iter, output,
rcu_read_lock();
cds_lfht_for_each_entry(obj->output_ht->ht, &iter.iter, output,