[Asterisk-cvs] asterisk/channels chan_zap.c,1.305,1.306

markster at lists.digium.com markster at lists.digium.com
Sat Jul 24 20:07:03 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory localhost.localdomain:/tmp/cvs-serv14805/channels

Modified Files:
	chan_zap.c 
Log Message:
Sometimes we get subunalloced, gotta free lock first


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.305
retrieving revision 1.306
diff -u -d -r1.305 -r1.306
--- chan_zap.c	24 Jul 2004 23:45:37 -0000	1.305
+++ chan_zap.c	24 Jul 2004 23:53:02 -0000	1.306
@@ -2869,7 +2869,8 @@
 					p->subs[SUB_REAL].owner->bridge->name, p->subs[SUB_THREEWAY].owner->name);
 			return -1;
 		}
-		/* Orphan the channel */
+		/* Orphan the channel after releasing the lock */
+		ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock);
 		unalloc_sub(p, SUB_THREEWAY);
 	} else if (p->subs[SUB_THREEWAY].owner->bridge) {
 		if (p->subs[SUB_REAL].owner->_state == AST_STATE_RINGING) {
@@ -2882,6 +2883,7 @@
 			return -1;
 		}
 		swap_subs(p, SUB_THREEWAY, SUB_REAL);
+		ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock);
 		unalloc_sub(p, SUB_THREEWAY);
 		/* Tell the caller not to hangup */
 		return 1;
@@ -3213,7 +3215,8 @@
 								}
 							} else
 								p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
-							ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock);
+							if (p->subs[SUB_THREEWAY].owner)
+								ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock);
 						} else {
 							ast_mutex_unlock(&p->subs[SUB_THREEWAY].owner->lock);
 							/* Swap subs and dis-own channel */




More information about the svn-commits mailing list