diff options
author | Richard Mudgett <rmudgett@digium.com> | 2016-06-22 18:02:59 -0500 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2016-06-30 15:40:38 -0500 |
commit | 656ed73ac686f2e7d4afcbd46a4a04086a3502c6 (patch) | |
tree | b4dbcd171566e97c89efa9a7b884efcd68028fae /channels/chan_pjsip.c | |
parent | 5ad7e1c09a7db698f0e4dd95f9153a70f8a1c667 (diff) |
res_pjsip: Add missing NULL checks when using pjsip_inv_end_session().
pjsip_inv_end_session() is documented as being able to return the
passed in tdata parameter set to NULL on success.
Change-Id: I09d53725c49b7183c41bfa1be3ff225f3a8d3047
Diffstat (limited to 'channels/chan_pjsip.c')
-rw-r--r-- | channels/chan_pjsip.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c index 22f834d37..5ad117404 100644 --- a/channels/chan_pjsip.c +++ b/channels/chan_pjsip.c @@ -1466,7 +1466,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; @@ -2231,7 +2232,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); } |