mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 12:36:58 +00:00
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
This commit is contained in:
@@ -1466,7 +1466,8 @@ static void transfer_redirect(struct ast_sip_session *session, const char *targe
|
|||||||
pjsip_contact_hdr *contact;
|
pjsip_contact_hdr *contact;
|
||||||
pj_str_t tmp;
|
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_log(LOG_WARNING, "Failed to redirect PJSIP session for channel %s\n",
|
||||||
ast_channel_name(session->channel));
|
ast_channel_name(session->channel));
|
||||||
message = AST_TRANSFER_FAILED;
|
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);
|
ast_sip_session_add_datastore(session, datastore);
|
||||||
|
|
||||||
if (!(session->channel = chan_pjsip_new(session, AST_STATE_RING, session->exten, NULL, NULL, NULL, NULL))) {
|
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);
|
ast_sip_session_send_response(session, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -969,7 +969,8 @@ inv_replace_failed:
|
|||||||
session->defer_terminate = 1;
|
session->defer_terminate = 1;
|
||||||
ast_hangup(session->channel);
|
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);
|
ast_sip_session_send_response(session, packet);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -2651,7 +2651,8 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans
|
|||||||
}
|
}
|
||||||
if (tsx->status_code != 488) {
|
if (tsx->status_code != 488) {
|
||||||
/* Other reinvite failures (except 488) result in destroying the session. */
|
/* 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);
|
ast_sip_session_send_request(session, tdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2664,7 +2665,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
|
* a cancelled call. Our role is to immediately send a BYE to end the
|
||||||
* dialog.
|
* 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);
|
ast_sip_session_send_request(session, tdata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user