aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r--channels/chan_agent.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 535056ecb..b705b6f04 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -463,8 +463,9 @@ static int agent_cleanup(struct agent_pvt *p)
/* Release ownership of the agent to other threads (presumably running the login app). */
p->app_lock_flag = 0;
ast_cond_signal(&p->app_complete_cond);
- if (chan)
- ast_channel_free(chan);
+ if (chan) {
+ chan = ast_channel_release(chan);
+ }
if (p->dead) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
@@ -1124,7 +1125,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
p->owner = NULL;
tmp->tech_pvt = NULL;
p->app_sleep_cond = 1;
- ast_channel_free( tmp );
+ tmp = ast_channel_release(tmp);
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
p->app_lock_flag = 0;
ast_cond_signal(&p->app_complete_cond);
@@ -1138,7 +1139,7 @@ static struct ast_channel *agent_new(struct agent_pvt *p, int state)
p->owner = NULL;
tmp->tech_pvt = NULL;
p->app_sleep_cond = 1;
- ast_channel_free( tmp );
+ tmp = ast_channel_release(tmp);
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
return NULL;
}