diff --git a/daemon/janus.c b/daemon/janus.c index 60eb41ce8..a6b6dd9b8 100644 --- a/daemon/janus.c +++ b/daemon/janus.c @@ -1465,8 +1465,11 @@ static const char *janus_destroy(struct websocket_message *wm, JsonReader *reade struct janus_session *ht_session = NULL; t_hash_table_steal_extended(janus_sessions, &session->id, NULL, &ht_session); - if (ht_session != session) + if (ht_session != session) { + if (ht_session) // return wrongly stolen session + t_hash_table_insert(janus_sessions, &ht_session->id, ht_session); return "Sesssion ID not found"; // already removed/destroyed + } janus_session_cleanup(session); obj_put(session);