* Delete session from the session list and free the memory.
*
* Return -1 if no session is found. On success, return 1;
+ * Should *NOT* be called with RCU read-side lock held.
*/
int session_destroy(struct ltt_session *session)
{
del_session_list(session);
pthread_mutex_destroy(&session->lock);
- rcu_read_lock();
consumer_destroy_output(session->consumer);
- rcu_read_unlock();
+ snapshot_destroy(&session->snapshot);
free(session);
return LTTNG_OK;
new_session->uid = uid;
new_session->gid = gid;
+ ret = snapshot_init(&new_session->snapshot);
+ if (ret < 0) {
+ ret = LTTNG_ERR_NOMEM;
+ goto error;
+ }
+
/* Add new session to the session list */
session_lock_list();
new_session->id = add_session_list(new_session);