[Asterisk-cvs] asterisk/channels chan_agent.c, 1.81.2.1, 1.81.2.2 chan_local.c, 1.32.2.1, 1.32.2.2

russell at lists.digium.com russell at lists.digium.com
Wed Dec 15 14:10:30 CST 2004


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

Modified Files:
      Tag: v1-0
	chan_agent.c chan_local.c 
Log Message:
Fix use count for agent/local (bug #2996)


Index: chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.81.2.1
retrieving revision 1.81.2.2
diff -u -d -r1.81.2.1 -r1.81.2.2
--- chan_agent.c	16 Oct 2004 15:35:23 -0000	1.81.2.1
+++ chan_agent.c	15 Dec 2004 19:07:10 -0000	1.81.2.2
@@ -527,6 +527,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.32.2.1
retrieving revision 1.32.2.2
diff -u -d -r1.32.2.1 -r1.32.2.2
--- chan_local.c	26 Oct 2004 14:42:01 -0000	1.32.2.1
+++ chan_local.c	15 Dec 2004 19:07:10 -0000	1.32.2.2
@@ -304,6 +304,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;
@@ -441,6 +445,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