From 1c5433a877dd85208371eed7284495c875788a97 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 7 Sep 2021 19:08:32 -0400 Subject: [PATCH] TT#14008 fix Coverity MISSING_LOCK warning This isn't really necessary as at this point the janus_session object is private to the thread, but we add the locking anyway to silence the warning. Warned-by: Coverity Change-Id: I0b192f2f5827ad917cf5110ce486fc6cd49e1a71 --- daemon/janus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daemon/janus.c b/daemon/janus.c index 0889ae30b..ef2ea5d67 100644 --- a/daemon/janus.c +++ b/daemon/janus.c @@ -856,6 +856,7 @@ const char *janus_create(JsonReader *reader, JsonBuilder *builder, struct websoc struct janus_session *session = obj_alloc0("janus_session", sizeof(*session), __janus_session_free); mutex_init(&session->lock); + mutex_lock(&session->lock); // not really necessary but Coverity complains session->last_act = rtpe_now.tv_sec; session->websockets = g_hash_table_new(g_direct_hash, g_direct_equal); session->handles = g_hash_table_new(g_int64_hash, g_int64_equal); @@ -876,6 +877,7 @@ const char *janus_create(JsonReader *reader, JsonBuilder *builder, struct websoc mutex_unlock(&janus_lock); } while (!session_id); + mutex_unlock(&session->lock); ilog(LOG_INFO, "Created new Janus session with ID %" PRIu64, session_id);