aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_local.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-11 04:46:49 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-12-11 04:46:49 +0000
commitf975cf1ad60aad9f51c1bfaa6e15762d36579be1 (patch)
tree6c8476df117b7c7c1611accdfcf126d3d7d41324 /channels/chan_local.c
parent6c009e04ff978428f3aee7db4ca31876c993edba (diff)
Fix use count for agent/local (bug #2996 et al)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@4425 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rwxr-xr-xchannels/chan_local.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index fc5c74fea..b1998f1c8 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -312,6 +312,10 @@ static int local_hangup(struct ast_channel *ast)
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 @@ static struct ast_channel *local_new(struct local_pvt *p, int state)
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);