mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
- move the increase of the use count to be after the possible failures
- if the pbx fails to start, set the owner channel of the pvt strucutre to be NULL - return immediately if the pbx fails to start so the loop to set all of the variables from the "setvar" options aren't set as a bunch of global variables instead git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@35554 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3307,20 +3307,20 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability)
|
||||
i->owner = tmp;
|
||||
i->capability = capability;
|
||||
ast_setstate(tmp, state);
|
||||
ast_mutex_lock(&usecnt_lock);
|
||||
usecnt++;
|
||||
ast_mutex_unlock(&usecnt_lock);
|
||||
ast_update_use_count();
|
||||
if (state != AST_STATE_DOWN) {
|
||||
if (ast_pbx_start(tmp)) {
|
||||
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
|
||||
ast_hangup(tmp);
|
||||
tmp = NULL;
|
||||
i->owner = NULL;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
for (v = i->vars ; v ; v = v->next)
|
||||
pbx_builtin_setvar_helper(tmp,v->name,v->value);
|
||||
|
||||
ast_mutex_lock(&usecnt_lock);
|
||||
usecnt++;
|
||||
ast_mutex_unlock(&usecnt_lock);
|
||||
ast_update_use_count();
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
Reference in New Issue
Block a user