]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix multiple missing session unlocks in switch_core_media.c
authorAndrey Volk <andywolk@gmail.com>
Mon, 18 May 2020 22:48:02 +0000 (02:48 +0400)
committerAndrey Volk <andywolk@gmail.com>
Tue, 16 Mar 2021 17:30:39 +0000 (20:30 +0300)
src/switch_core_media.c

index 0ae007ad90e15db253e6f4d177e7b2d25bbfe0cc..d69e1286f51fac0ce2d69f89a68e3597ddf2b477 100644 (file)
@@ -6791,6 +6791,7 @@ static void *SWITCH_THREAD_FUNC video_write_thread(switch_thread_t *thread, void
        }
 
        if (!(smh = session->media_handle)) {
+               switch_core_session_rwunlock(session);
                return NULL;
        }
 
@@ -7301,12 +7302,14 @@ static void *SWITCH_THREAD_FUNC text_helper_thread(switch_thread_t *thread, void
                return NULL;
        }
 
-       mh->ready = 1;
-
        if (!(smh = session->media_handle)) {
+               switch_core_session_rwunlock(session);
+               mh->ready = -1;
                return NULL;
        }
 
+       mh->ready = 1;
+
        channel = switch_core_session_get_channel(session);
 
        if (switch_channel_var_true(session->channel, "fire_text_events")) {
@@ -7460,12 +7463,14 @@ static void *SWITCH_THREAD_FUNC video_helper_thread(switch_thread_t *thread, voi
                return NULL;
        }
 
-       mh->ready = 1;
-
        if (!(smh = session->media_handle)) {
+               switch_core_session_rwunlock(session);
+               mh->ready = -1;
                return NULL;
        }
 
+       mh->ready = 1;
+
        channel = switch_core_session_get_channel(session);
 
        switch_core_autobind_cpu();