[asterisk-commits] russell: branch 1.2 r51197 -
	/branches/1.2/channels/chan_sip.c
    asterisk-commits at lists.digium.com 
    asterisk-commits at lists.digium.com
       
    Wed Jan 17 14:17:22 MST 2007
    
    
  
Author: russell
Date: Wed Jan 17 15:17:21 2007
New Revision: 51197
URL: http://svn.digium.com/view/asterisk?view=rev&rev=51197
Log:
Move the check for a failure of ast_channel_alloc() to before locking the
pvt structure again.  Otherwise, on a failure, this will cause a deadlock.
Modified:
    branches/1.2/channels/chan_sip.c
Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?view=diff&rev=51197&r1=51196&r2=51197
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Wed Jan 17 15:17:21 2007
@@ -2782,11 +2782,11 @@
 	ast_mutex_unlock(&i->lock);
 	/* Don't hold a sip pvt lock while we allocate a channel */
 	tmp = ast_channel_alloc(1);
-	ast_mutex_lock(&i->lock);
 	if (!tmp) {
 		ast_log(LOG_WARNING, "Unable to allocate SIP channel structure\n");
 		return NULL;
 	}
+	ast_mutex_lock(&i->lock);
 	tmp->tech = &sip_tech;
 	/* Select our native format based on codec preference until we receive
 	   something from another device to the contrary. */
    
    
More information about the asterisk-commits
mailing list