summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2008-03-10 20:05:12 +0000
committerRussell Bryant <russell@russellbryant.com>2008-03-10 20:05:12 +0000
commit2d95fb33bd741f27d99f97dbc4777b1f8c0bee6f (patch)
tree80463a50f763a5d493772cec31d6e6e99c8921bc /main/pbx.c
parent362b184c9c8832d41558a319288badd895583f43 (diff)
Merged revisions 107158 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r107158 | russell | 2008-03-10 15:04:27 -0500 (Mon, 10 Mar 2008) | 9 lines Fix some bugs related to originating calls. If the code failed to start a PBX on the channel (such as if you set a call limit based on the system's load average), then there were cases where a channel that has already been free'd using ast_hangup() got accessed. This caused weird memory corruption and crashes to occur. (fixes issue BE-386) (much debugging credit goes to twilson, final patch written by me) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@107159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 427c0cca9..9050c55fa 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -6534,6 +6534,7 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
if (channel)
*channel = NULL;
ast_hangup(chan);
+ chan = NULL;
res = -1;
}
} else {
@@ -6544,6 +6545,7 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
ast_channel_unlock(chan);
}
ast_hangup(chan);
+ chan = NULL;
res = -1;
}
}
@@ -6562,6 +6564,7 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
ast_channel_unlock(chan);
}
ast_hangup(chan);
+ chan = NULL;
}
}
@@ -6589,7 +6592,11 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
pbx_builtin_setvar_helper(chan, "REASON", failed_reason);
if (account)
ast_cdr_setaccount(chan, account);
- ast_pbx_run(chan);
+ if (ast_pbx_run(chan)) {
+ ast_log(LOG_ERROR, "Unable to run PBX on %s\n", chan->name);
+ ast_hangup(chan);
+ }
+ chan = NULL;
}
}
}