From e94f240a884c349c7b9fe39e6edb47948eb9c200 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Sun, 13 Oct 2013 15:41:37 +0000 Subject: [PATCH] Fix a race condition in res_pjsip_session with rapidly terminating the session. The INVITE session state callback wrongly assumes that a session will always exist, but when rapidly terminating the session this assumption goes out the window. As all handler code for the INVITE session state callback requires the session it will now just exit immediately if no session exists. (closes issue ASTERISK-22668) Reported by: John Bigelow git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@400872 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_pjsip_session.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index a186bf67ca..4dae4b4830 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -1814,6 +1814,10 @@ static void session_inv_on_state_changed(pjsip_inv_session *inv, pjsip_event *e) print_debug_details(inv, NULL, e); + if (!session) { + return; + } + switch(e->type) { case PJSIP_EVENT_TX_MSG: handle_outgoing(session, e->body.tx_msg.tdata);