[Freeswitch-svn] [commit] r10766 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Mon Dec 15 08:10:22 PST 2008


Author: anthm
Date: Mon Dec 15 11:10:20 2008
New Revision: 10766

Log:
fix null mutex race cond

Modified:
   freeswitch/trunk/src/switch_core_io.c

Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c	(original)
+++ freeswitch/trunk/src/switch_core_io.c	Mon Dec 15 11:10:20 2008
@@ -600,12 +600,16 @@
 	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) {



More information about the Freeswitch-svn mailing list