Merge "CHAOS: avoid crash if string create fails"
authorJoshua Colp <jcolp@digium.com>
Sat, 19 Sep 2015 13:22:45 +0000 (08:22 -0500)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Sat, 19 Sep 2015 13:22:45 +0000 (08:22 -0500)
channels/chan_pjsip.c

index 9603f05..153b2a3 100644 (file)
@@ -160,10 +160,10 @@ static struct ast_sip_session_supplement chan_pjsip_ack_supplement = {
 static enum ast_rtp_glue_result chan_pjsip_get_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance **instance)
 {
        struct ast_sip_channel_pvt *channel = ast_channel_tech_pvt(chan);
-       struct chan_pjsip_pvt *pvt = channel->pvt;
+       struct chan_pjsip_pvt *pvt;
        struct ast_sip_endpoint *endpoint;
 
-       if (!pvt || !channel->session || !pvt->media[SIP_MEDIA_AUDIO]->rtp) {
+       if (!channel || !channel->session || !(pvt = channel->pvt) || !pvt->media[SIP_MEDIA_AUDIO]->rtp) {
                return AST_RTP_GLUE_RESULT_FORBID;
        }