From: Anthony Minessale Date: Mon, 15 Dec 2008 16:10:20 +0000 (+0000) Subject: fix null mutex race cond X-Git-Tag: v1.0.2~237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f2f60c4a00030a8cac48e685449aef1e9a5d69c;p=thirdparty%2Ffreeswitch.git fix null mutex race cond git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10766 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 990df63ef1..5286bc94e7 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -600,12 +600,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess switch_assert(frame->codec != NULL); switch_assert(frame->codec->implementation != NULL); - if (!(session->write_codec && frame->codec)) { + switch_mutex_lock(session->codec_write_mutex); + + if (!(session->write_codec && session->write_codec->mutex && frame->codec)) { + switch_mutex_unlock(session->codec_write_mutex); return SWITCH_STATUS_FALSE; } + switch_mutex_lock(session->write_codec->mutex); switch_mutex_lock(frame->codec->mutex); - switch_mutex_lock(session->codec_write_mutex); + if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) { if (session->write_codec->implementation->codec_id == frame->codec->implementation->codec_id) {