diff options
author | Joshua Colp <jcolp@digium.com> | 2016-07-01 11:15:59 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-07-01 11:15:59 -0500 |
commit | 9e72f29ddd9330b247e0e489896d4411056fe90a (patch) | |
tree | 4cdcbf9d81ba3bff8fd98088734a5d6f171f2456 | |
parent | d8b8dca04b4b18e218a52de35ce0cae96ea6d911 (diff) | |
parent | 28928ba5c4f92d407e9f161ebc5a1441261a2de0 (diff) |
Merge "res_pjsip: Add missing NULL checks when using pjsip_inv_end_session()." into 13
-rw-r--r-- | channels/chan_pjsip.c | 6 | ||||
-rw-r--r-- | res/res_pjsip_refer.c | 3 | ||||
-rw-r--r-- | res/res_pjsip_session.c | 6 |
3 files changed, 10 insertions, 5 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 970fef496..bbccb53a9 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1417,7 +1417,8 @@ static void transfer_redirect(struct ast_sip_session *session, const char *targe pjsip_contact_hdr *contact; pj_str_t tmp; - if (pjsip_inv_end_session(session->inv_session, 302, NULL, &packet) != PJ_SUCCESS) { + if (pjsip_inv_end_session(session->inv_session, 302, NULL, &packet) != PJ_SUCCESS + || !packet) { ast_log(LOG_WARNING, "Failed to redirect PJSIP session for channel %s\n", ast_channel_name(session->channel)); message = AST_TRANSFER_FAILED; @@ -2182,7 +2183,8 @@ static int chan_pjsip_incoming_request(struct ast_sip_session *session, struct p ast_sip_session_add_datastore(session, datastore); if (!(session->channel = chan_pjsip_new(session, AST_STATE_RING, session->exten, NULL, NULL, NULL, NULL))) { - if (pjsip_inv_end_session(session->inv_session, 503, NULL, &packet) == PJ_SUCCESS) { + if (pjsip_inv_end_session(session->inv_session, 503, NULL, &packet) == PJ_SUCCESS + && packet) { ast_sip_session_send_response(session, packet); } diff --git a/res/res_pjsip_refer.c b/res/res_pjsip_refer.c index f3af65c3c..e5bb90e5c 100644 --- a/res/res_pjsip_refer.c +++ b/res/res_pjsip_refer.c @@ -969,7 +969,8 @@ inv_replace_failed: session->defer_terminate = 1; ast_hangup(session->channel); - if (pjsip_inv_end_session(session->inv_session, response, NULL, &packet) == PJ_SUCCESS) { + if (pjsip_inv_end_session(session->inv_session, response, NULL, &packet) == PJ_SUCCESS + && packet) { ast_sip_session_send_response(session, packet); } } else { diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index 23d2f2f2a..5bbd0c01b 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -2619,7 +2619,8 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans } if (tsx->status_code != 488) { /* Other reinvite failures (except 488) result in destroying the session. */ - if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS) { + if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS + && tdata) { ast_sip_session_send_request(session, tdata); } } @@ -2632,7 +2633,8 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans * a cancelled call. Our role is to immediately send a BYE to end the * dialog. */ - if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS) { + if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS + && tdata) { ast_sip_session_send_request(session, tdata); } } |