MT#55283 fix session reference booboo

If we remove a session that is not the session we're looking for
(re-used session ID after a removal race), we must return the incorrect
session to the hash table.

Change-Id: Iab73e1994251e5be766406b4e537a954b0e81f07
(cherry picked from commit 164f688fc1)
(cherry picked from commit 4228dc5b68)
mr12.5.1
Richard Fuchs 8 months ago
parent 5cafeb8151
commit d0ed54e004

@ -1462,8 +1462,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);

Loading…
Cancel
Save