[svn-commits] tilghman: branch 1.6.0 r123394 - in /branches/1.6.0: ./ channels/chan_iax2.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 17 14:01:34 CDT 2008


Author: tilghman
Date: Tue Jun 17 14:01:33 2008
New Revision: 123394

URL: http://svn.digium.com/view/asterisk?view=rev&rev=123394
Log:
Merged revisions 123392 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r123392 | tilghman | 2008-06-17 13:57:45 -0500 (Tue, 17 Jun 2008) | 11 lines

Merged revisions 123391 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r123391 | tilghman | 2008-06-17 13:56:53 -0500 (Tue, 17 Jun 2008) | 3 lines

Fix 3 more places where deadlock avoidance could cause the wrong lock to be
unlocked.  (Closes issue #12795)

........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_iax2.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_iax2.c?view=diff&rev=123394&r1=123393&r2=123394
==============================================================================
--- branches/1.6.0/channels/chan_iax2.c (original)
+++ branches/1.6.0/channels/chan_iax2.c Tue Jun 17 14:01:33 2008
@@ -9552,9 +9552,10 @@
 	 * call has the pointer to IP and must be updated to the new one
 	 */
 	if (reg->dnsmgr && ast_dnsmgr_changed(reg->dnsmgr) && (reg->callno > 0)) {
-		ast_mutex_lock(&iaxsl[reg->callno]);
-		iax2_destroy(reg->callno);
-		ast_mutex_unlock(&iaxsl[reg->callno]);
+		int callno = reg->callno;
+		ast_mutex_lock(&iaxsl[callno]);
+		iax2_destroy(callno);
+		ast_mutex_unlock(&iaxsl[callno]);
 		reg->callno = 0;
 	}
 	if (!reg->addr.sin_addr.s_addr) {
@@ -10156,13 +10157,14 @@
 static void peer_destructor(void *obj)
 {
 	struct iax2_peer *peer = obj;
+	int callno = peer->callno;
 
 	ast_free_ha(peer->ha);
 
-	if (peer->callno > 0) {
-		ast_mutex_lock(&iaxsl[peer->callno]);
-		iax2_destroy(peer->callno);
-		ast_mutex_unlock(&iaxsl[peer->callno]);
+	if (callno > 0) {
+		ast_mutex_lock(&iaxsl[callno]);
+		iax2_destroy(callno);
+		ast_mutex_unlock(&iaxsl[callno]);
 	}
 
 	register_peer_exten(peer, 0);
@@ -10669,12 +10671,13 @@
 	while ((reg = AST_LIST_REMOVE_HEAD(&registrations, entry))) {
 		AST_SCHED_DEL(sched, reg->expire);
 		if (reg->callno) {
-			ast_mutex_lock(&iaxsl[reg->callno]);
-			if (iaxs[reg->callno]) {
-				iaxs[reg->callno]->reg = NULL;
-				iax2_destroy(reg->callno);
+			int callno = reg->callno;
+			ast_mutex_lock(&iaxsl[callno]);
+			if (iaxs[callno]) {
+				iaxs[callno]->reg = NULL;
+				iax2_destroy(callno);
 			}
-			ast_mutex_unlock(&iaxsl[reg->callno]);
+			ast_mutex_unlock(&iaxsl[callno]);
 		}
 		if (reg->dnsmgr)
 			ast_dnsmgr_release(reg->dnsmgr);




More information about the svn-commits mailing list