]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
don't segfault after starting sofia, upon xml_open_config lookup failure for the...
authorMichael Jerris <mike@jerris.com>
Mon, 11 Jun 2012 14:43:42 +0000 (10:43 -0400)
committerMichael Jerris <mike@jerris.com>
Mon, 11 Jun 2012 14:43:55 +0000 (10:43 -0400)
src/mod/endpoints/mod_sofia/sofia.c
src/switch_apr.c

index 78036c1895951871304a94f99d2cf0fe706af4cd..13e632af9f6128f7d35508aeea54458f2cf65768 100644 (file)
@@ -2252,7 +2252,11 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void
        sofia_clear_pflag_locked(profile, PFLAG_SHUTDOWN);
        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
 
-       switch_thread_join(&st, worker_thread);
+       if ( worker_thread ) {
+               switch_thread_join(&st, worker_thread);
+       } else {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Sofia worker thead failed to start\n");
+       }
 
        sanity = 4;
        while (profile->inuse) {
index 426bed59f5b91a9998fe33b693090542f0ee126b..5936c7223ea842e975c6a75551468123bb692242 100644 (file)
@@ -1169,6 +1169,11 @@ SWITCH_DECLARE(switch_status_t) switch_thread_exit(switch_thread_t *thd, switch_
  */
 SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
 {
+       if ( !thd ) {
+               switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: Attempting to join thread that does not exist\n");
+               return SWITCH_STATUS_FALSE;
+       }
+
        return apr_thread_join((apr_status_t *) retval, (apr_thread_t *) thd);
 }