[svn-commits] file: trunk r389609 - /trunk/res/res_sip_session.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 23 15:25:51 CDT 2013


Author: file
Date: Thu May 23 15:25:48 2013
New Revision: 389609

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389609
Log:
Fix a crash due to the INVITE session being destroyed before the session.

This change ensures that the INVITE session remains valid for the lifetime
of the session object itself by increasing the session count on the dialog that
the INVITE session is allocated from. Once this reaches zero (normally as a result
of decrementing it within the session destructor) the dialog, and INVITE session,
are destroyed.

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=389609&r1=389608&r2=389609
==============================================================================
--- trunk/res/res_sip_session.c (original)
+++ trunk/res/res_sip_session.c Thu May 23 15:25:48 2013
@@ -887,6 +887,10 @@
 	ast_party_id_free(&session->id);
 	ao2_cleanup(session->endpoint);
 	ast_format_cap_destroy(session->req_caps);
+
+	if (session->inv_session) {
+		pjsip_dlg_dec_session(session->inv_session->dlg, &session_module);
+	}
 }
 
 static int add_supplements(struct ast_sip_session *session)
@@ -945,6 +949,7 @@
 	}
 	ast_sip_dialog_set_serializer(inv_session->dlg, session->serializer);
 	ast_sip_dialog_set_endpoint(inv_session->dlg, endpoint);
+	pjsip_dlg_inc_session(inv_session->dlg, &session_module);
 	ao2_ref(endpoint, +1);
 	inv_session->mod_data[session_module.id] = session;
 	session->endpoint = endpoint;




More information about the svn-commits mailing list