[asterisk-commits] mmichelson: trunk r394473 - /trunk/res/res_sip_session.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 16 14:13:06 CDT 2013


Author: mmichelson
Date: Tue Jul 16 14:13:04 2013
New Revision: 394473

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394473
Log:
Prevent crash from trying to end a session in an invalid way.

This ensures that code that was only meant to be run on a reinvite failure
only runs on a reinvite failure.

(closes issue ASTERISK-22061)
reported by Rusty Newton


Modified:
    trunk/res/res_sip_session.c

Modified: trunk/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_sip_session.c?view=diff&rev=394473&r1=394472&r2=394473
==============================================================================
--- trunk/res/res_sip_session.c (original)
+++ trunk/res/res_sip_session.c Tue Jul 16 14:13:04 2013
@@ -1609,11 +1609,12 @@
 				if (tsx->status_code == PJSIP_SC_REQUEST_PENDING) {
 					reschedule_reinvite(session, tsx->mod_data[session_module.id], tsx->last_tx);
 					return;
-				} else {
-					/* Other failures result in destroying the session. */
+				} else if (inv->state == PJSIP_INV_STATE_CONFIRMED) {
+					/* Other reinvite failures result in destroying the session. */
 					pjsip_tx_data *tdata;
-					pjsip_inv_end_session(inv, 500, NULL, &tdata);
-					ast_sip_session_send_request(session, tdata);
+					if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS) {
+						ast_sip_session_send_request(session, tdata);
+					}
 				}
 			}
 		} else {




More information about the asterisk-commits mailing list