[asterisk-commits] file: branch file/gulp_new_invite r395186 - in /team/file/gulp_new_invite: ch...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 23 13:45:25 CDT 2013
Author: file
Date: Tue Jul 23 13:45:23 2013
New Revision: 395186
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395186
Log:
Fix ast_sip_session reference counting when allocating it and attaching to inv_session.
The returned session was sharing the reference held by inv_session.
Modified:
team/file/gulp_new_invite/channels/chan_gulp.c
team/file/gulp_new_invite/res/res_sip_session.c
Modified: team/file/gulp_new_invite/channels/chan_gulp.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_new_invite/channels/chan_gulp.c?view=diff&rev=395186&r1=395185&r2=395186
==============================================================================
--- team/file/gulp_new_invite/channels/chan_gulp.c (original)
+++ team/file/gulp_new_invite/channels/chan_gulp.c Tue Jul 23 13:45:23 2013
@@ -1604,7 +1604,7 @@
static struct ast_channel *gulp_request(const char *type, struct ast_format_cap *cap, const struct ast_channel *requestor, const char *data, int *cause)
{
struct request_data req_data;
- struct ast_sip_session *session;
+ RAII_VAR(struct ast_sip_session *, session, NULL, ao2_cleanup);
req_data.caps = cap;
req_data.dest = data;
Modified: team/file/gulp_new_invite/res/res_sip_session.c
URL: http://svnview.digium.com/svn/asterisk/team/file/gulp_new_invite/res/res_sip_session.c?view=diff&rev=395186&r1=395185&r2=395186
==============================================================================
--- team/file/gulp_new_invite/res/res_sip_session.c (original)
+++ team/file/gulp_new_invite/res/res_sip_session.c Tue Jul 23 13:45:23 2013
@@ -954,8 +954,9 @@
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(session, +1);
+ inv_session->mod_data[session_module.id] = session;
ao2_ref(endpoint, +1);
- inv_session->mod_data[session_module.id] = session;
session->endpoint = endpoint;
session->inv_session = inv_session;
session->req_caps = ast_format_cap_alloc_nolock();
@@ -1046,6 +1047,10 @@
ast_format_cap_copy(session->req_caps, req_caps);
if ((pjsip_dlg_add_usage(dlg, &session_module, NULL) != PJ_SUCCESS)) {
pjsip_inv_terminate(inv_session, 500, PJ_FALSE);
+ /* Since we are not notifying ourselves that the INVITE session is being terminated
+ * we need to manually drop its reference to session
+ */
+ ao2_ref(session, -1);
return NULL;
}
@@ -1189,7 +1194,7 @@
ast_pjsip_rdata_get_endpoint(rdata), ao2_cleanup);
pjsip_tx_data *tdata = NULL;
pjsip_inv_session *inv_session = NULL;
- struct ast_sip_session *session = NULL;
+ RAII_VAR(struct ast_sip_session *, session, NULL, ao2_cleanup);
pjsip_timer_setting timer;
pjsip_rdata_sdp_info *sdp_info;
pjmedia_sdp_session *local = NULL;
More information about the asterisk-commits
mailing list