From 957aff751d1363953a00aac7ddd9c772b405c574 Mon Sep 17 00:00:00 2001 From: "Joshua C. Colp" <jcolp@sangoma.com> Date: Tue, 22 Sep 2020 07:13:32 -0300 Subject: [PATCH] res_pjsip_session: Fix session reference leak. The ast_sip_dialog_get_session function returns the session with reference count increased. This was not taken into account and was causing sessions to remain around when they should not be. ASTERISK-29089 Change-Id: I430fa721b0a824311a59effec6056e9ec528e3e8 --- res/res_pjsip_session.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c index e970f66416..cd31acaddc 100644 --- a/res/res_pjsip_session.c +++ b/res/res_pjsip_session.c @@ -5297,7 +5297,7 @@ static void session_outgoing_nat_hook(pjsip_tx_data *tdata, struct ast_sip_trans tdata->mod_data, session_module.id, MOD_DATA_NAT_HOOK); struct pjmedia_sdp_session *sdp; pjsip_dialog *dlg = pjsip_tdata_get_dlg(tdata); - struct ast_sip_session *session = dlg ? ast_sip_dialog_get_session(dlg) : NULL; + RAII_VAR(struct ast_sip_session *, session, dlg ? ast_sip_dialog_get_session(dlg) : NULL, ao2_cleanup); int stream; /* SDP produced by us directly will never be multipart */ -- GitLab