From: Mike Jerris Date: Wed, 9 Nov 2016 22:26:41 +0000 (-0600) Subject: FS-9714: [mod_conference] fix crash due to race on closing file handles when playing... X-Git-Tag: v1.8.0~1109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7f45a772778a8fee1856cfc66e0d374ea7d0d57;p=thirdparty%2Ffreeswitch.git FS-9714: [mod_conference] fix crash due to race on closing file handles when playing a file to a conference via api command as a conference is shutting down --- diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 5d8961dd06..1be23ea88e 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -812,6 +812,8 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob } } + switch_mutex_lock(conference->mutex); + /* Close Unused Handles */ if (conference->fnode) { conference_file_node_t *fnode, *cur; @@ -840,6 +842,8 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob switch_core_destroy_memory_pool(&pool); } + switch_mutex_unlock(conference->mutex); + /* Wait till everybody is out */ conference_utils_clear_flag_locked(conference, CFLAG_RUNNING); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock ON\n");