aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-21 15:22:22 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-21 15:22:22 +0000
commitd9e46ad2447f0c348262b101da297e5ace9a4f3a (patch)
tree5c4d8de9b283cca6b6fc75fb9af6d6f573b10f82 /channels/chan_mgcp.c
parent39558bb82d0966b9cc6cbaddbf107b95737058e2 (diff)
Don't try to dereference the owner channel when it may not exist
(issue #10507, maxper) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@80132 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r--channels/chan_mgcp.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index bfcb3e8b4..d504e3679 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -3239,19 +3239,16 @@ static int handle_request(struct mgcp_subchannel *sub, struct mgcp_request *req,
(((ev[0] >= '0') && (ev[0] <= '9')) ||
((ev[0] >= 'A') && (ev[0] <= 'D')) ||
(ev[0] == '*') || (ev[0] == '#'))) {
- if (sub && (sub->owner->_state >= AST_STATE_UP)) {
+ if (sub && sub->owner && (sub->owner->_state >= AST_STATE_UP)) {
f.frametype = AST_FRAME_DTMF;
f.subclass = ev[0];
f.src = "mgcp";
- if (sub->owner) {
- /* XXX MUST queue this frame to all subs in threeway call if threeway call is active */
- mgcp_queue_frame(sub, &f);
- ast_mutex_lock(&sub->next->lock);
- if (sub->next->owner) {
- mgcp_queue_frame(sub->next, &f);
- }
- ast_mutex_unlock(&sub->next->lock);
- }
+ /* XXX MUST queue this frame to all subs in threeway call if threeway call is active */
+ mgcp_queue_frame(sub, &f);
+ ast_mutex_lock(&sub->next->lock);
+ if (sub->next->owner)
+ mgcp_queue_frame(sub->next, &f);
+ ast_mutex_unlock(&sub->next->lock);
if (strstr(p->curtone, "wt") && (ev[0] == 'A')) {
memset(p->curtone, 0, sizeof(p->curtone));
}