[asterisk-commits] russell: branch 1.4 r51198 - in /branches/1.4: ./ channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 17 14:18:36 MST 2007


Author: russell
Date: Wed Jan 17 15:18:35 2007
New Revision: 51198

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51198
Log:
Merged revisions 51197 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r51197 | russell | 2007-01-17 15:17:21 -0600 (Wed, 17 Jan 2007) | 3 lines

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.4/   (props changed)
    branches/1.4/channels/chan_sip.c

Propchange: branches/1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=51198&r1=51197&r2=51198
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Wed Jan 17 15:18:35 2007
@@ -3735,11 +3735,11 @@
 		tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, "SIP/%s-%08x", my_name, (int)(long) i);
 
 	}
-	ast_mutex_lock(&i->lock);
 	if (!tmp) {
 		ast_log(LOG_WARNING, "Unable to allocate AST channel structure for SIP channel\n");
 		return NULL;
 	}
+	ast_mutex_lock(&i->lock);
 	tmp->tech = &sip_tech;
 
 	/* Select our native format based on codec preference until we receive



More information about the asterisk-commits mailing list