Fix race in agent/masquerade

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1196 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-07-16 18:54:16 +00:00
parent cd16a399e5
commit 2984b40bc9
2 changed files with 3 additions and 0 deletions

View File

@@ -634,8 +634,10 @@ static int check_availability(struct agent_pvt *newlyavailable, int needlock)
ast_setstate(chan, AST_STATE_UP);
/* Go ahead and mark the channel as a zombie so that masquerade will
destroy it for us, and we need not call ast_hangup */
ast_pthread_mutex_lock(&parent->lock);
chan->zombie = 1;
ast_channel_masquerade(parent, chan);
ast_pthread_mutex_unlock(&parent->lock);
p->abouttograb = 0;
} else {
ast_log(LOG_DEBUG, "Sneaky, parent disappeared in the mean time...\n");