[asterisk-commits] russell: trunk r115552 - in /trunk: ./ main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 8 10:26:49 CDT 2008


Author: russell
Date: Thu May  8 10:26:49 2008
New Revision: 115552

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115552
Log:
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

........

Modified:
    trunk/   (props changed)
    trunk/main/pbx.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=115552&r1=115551&r2=115552
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Thu May  8 10:26:49 2008
@@ -6310,13 +6310,13 @@
 		   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;




More information about the asterisk-commits mailing list