[Asterisk-cvs] asterisk/channels chan_agent.c, 1.96, 1.97 chan_local.c, 1.38, 1.39

markster at lists.digium.com markster at lists.digium.com
Fri Dec 10 23:49:28 CST 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv19838/channels

Modified Files:
	chan_agent.c chan_local.c 
Log Message:
Fix use count for agent/local (bug #2996 et al)


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -d -r1.96 -r1.97
--- chan_agent.c	10 Dec 2004 17:37:20 -0000	1.96
+++ chan_agent.c	11 Dec 2004 04:46:49 -0000	1.97
@@ -561,6 +561,10 @@
 	 * as in apps/app_chanisavail.c:chanavail_exec()
 	 */
 
+	ast_mutex_lock(&usecnt_lock);
+	usecnt--;
+	ast_mutex_unlock(&usecnt_lock);
+
 	ast_log(LOG_DEBUG, "Hangup called for state %s\n", ast_state2str(ast->_state));
 	if (p->start && (ast->_state != AST_STATE_UP)) {
 		howlong = time(NULL) - p->start;

Index: chan_local.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_local.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- chan_local.c	6 Nov 2004 21:33:01 -0000	1.38
+++ chan_local.c	11 Dec 2004 04:46:49 -0000	1.39
@@ -312,6 +312,10 @@
 		p->owner = NULL;
 	ast->pvt->pvt = NULL;
 	
+	ast_mutex_lock(&usecnt_lock);
+	usecnt--;
+	ast_mutex_unlock(&usecnt_lock);
+	
 	if (!p->owner && !p->chan) {
 		/* Okay, done with the private part now, too. */
 		glaredetect = p->glaredetect;
@@ -452,6 +456,7 @@
 		p->chan = tmp2;
 		ast_mutex_lock(&usecnt_lock);
 		usecnt++;
+		usecnt++;
 		ast_mutex_unlock(&usecnt_lock);
 		ast_update_use_count();
 		strncpy(tmp->context, p->context, sizeof(tmp->context)-1);




More information about the svn-commits mailing list