From b5f8f56bd0e43464471ce82a8284cab7488edf67 Mon Sep 17 00:00:00 2001 From: Kinsey Moore Date: Wed, 5 Mar 2014 19:28:31 +0000 Subject: bridge_native_rtp: Fix crash involving masquerade It is possible for a channel to be masqueraded out of a bridge which means it may no longer have RTP glue to check upon leaving said bridge. If this situation occurred (it's possible at least during dial and call pickup) then Asterisk would crash. This change makes sure the glue is checked before use. (closes issue AST-1290) Reported by: John Bigelow ........ Merged revisions 409900 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@409904 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bridges/bridge_native_rtp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'bridges') diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c index 7edcfd71a..02b094b31 100644 --- a/bridges/bridge_native_rtp.c +++ b/bridges/bridge_native_rtp.c @@ -452,9 +452,19 @@ static void native_rtp_bridge_leave(struct ast_bridge *bridge, struct ast_bridge native_rtp_bridge_framehook_detach(bridge_channel); glue = ast_rtp_instance_get_glue(ast_channel_tech(bridge_channel->chan)->type); + if (!glue) { + return; + } + glue->get_rtp_info(bridge_channel->chan, &instance); - glue->get_vrtp_info ? glue->get_vrtp_info(bridge_channel->chan, &vinstance) : AST_RTP_GLUE_RESULT_FORBID; - glue->get_trtp_info ? glue->get_trtp_info(bridge_channel->chan, &tinstance) : AST_RTP_GLUE_RESULT_FORBID; + + if (glue->get_vrtp_info) { + glue->get_vrtp_info(bridge_channel->chan, &vinstance); + } + + if (glue->get_trtp_info) { + glue->get_trtp_info(bridge_channel->chan, &tinstance); + } /* Tear down P2P bridges */ if (instance) { -- cgit v1.2.3