mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 03:18:30 +00:00
Don't use a channel before checking for channel allocation failure.
(closes issue #12609) Reported by: edantie git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@115551 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
12
main/pbx.c
12
main/pbx.c
@@ -4609,13 +4609,13 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
|
|||||||
the PBX, we have to make a new channel, masquerade, and start the PBX
|
the PBX, we have to make a new channel, masquerade, and start the PBX
|
||||||
at the new location */
|
at the new location */
|
||||||
struct ast_channel *tmpchan = ast_channel_alloc(0, chan->_state, 0, 0, chan->accountcode, chan->exten, chan->context, chan->amaflags, "AsyncGoto/%s", chan->name);
|
struct ast_channel *tmpchan = ast_channel_alloc(0, chan->_state, 0, 0, chan->accountcode, chan->exten, chan->context, chan->amaflags, "AsyncGoto/%s", chan->name);
|
||||||
if (chan->cdr) {
|
if (!tmpchan) {
|
||||||
ast_cdr_discard(tmpchan->cdr);
|
|
||||||
tmpchan->cdr = ast_cdr_dup(chan->cdr); /* share the love */
|
|
||||||
}
|
|
||||||
if (!tmpchan)
|
|
||||||
res = -1;
|
res = -1;
|
||||||
else {
|
} else {
|
||||||
|
if (chan->cdr) {
|
||||||
|
ast_cdr_discard(tmpchan->cdr);
|
||||||
|
tmpchan->cdr = ast_cdr_dup(chan->cdr); /* share the love */
|
||||||
|
}
|
||||||
/* Make formats okay */
|
/* Make formats okay */
|
||||||
tmpchan->readformat = chan->readformat;
|
tmpchan->readformat = chan->readformat;
|
||||||
tmpchan->writeformat = chan->writeformat;
|
tmpchan->writeformat = chan->writeformat;
|
||||||
|
|||||||
Reference in New Issue
Block a user