diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-05-08 15:26:49 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-05-08 15:26:49 +0000 |
commit | e40c662a06459d5659056cd98745b6295d870ed5 (patch) | |
tree | c5416e829f4c4a6a43cda49e414ebc53c20700fa /main | |
parent | 4465c8704ddcbde916f9aab0ec5b70941fd3bdfb (diff) |
Merged revisions 115551 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r115551 | russell | 2008-05-08 10:24:54 -0500 (Thu, 08 May 2008) | 4 lines
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/trunk@115552 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/pbx.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/main/pbx.c b/main/pbx.c index 73a5761b6..b2c5e22b3 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -6310,13 +6310,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 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); - if (chan->cdr) { - ast_cdr_discard(tmpchan->cdr); - tmpchan->cdr = ast_cdr_dup(chan->cdr); /* share the love */ - } - if (!tmpchan) + if (!tmpchan) { 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 */ tmpchan->readformat = chan->readformat; tmpchan->writeformat = chan->writeformat; |