aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-10 20:04:27 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-10 20:04:27 +0000
commita17a34aaa02ec4c034e9e1d268ee4025ad417bd1 (patch)
tree12b3dcfebd159b4540b4b45aaa27cb970b2f09f2 /main
parente1d39ac096d7c2e6e9288ff2f3e1e951f616aade (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@107158 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/pbx.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/pbx.c b/main/pbx.c
index d057ae264..728e40170 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5016,6 +5016,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 {
@@ -5026,6 +5027,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;
}
}
@@ -5045,6 +5047,7 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
ast_channel_unlock(chan);
}
ast_hangup(chan);
+ chan = NULL;
}
}
@@ -5072,7 +5075,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;
}
}
}