[Asterisk-code-review] res_pjsip_session: Fix session reference leak. (asterisk[certified/16.8])

Joshua Colp asteriskteam at digium.com
Wed Sep 23 09:55:16 CDT 2020


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14982 )

Change subject: res_pjsip_session: Fix session reference leak.
......................................................................

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
---
M res/res_pjsip_session.c
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Joshua Colp: Approved for Submit



diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 2c46170..7581ac5 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -5148,7 +5148,7 @@
 		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 */

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14982
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: certified/16.8
Gerrit-Change-Id: I430fa721b0a824311a59effec6056e9ec528e3e8
Gerrit-Change-Number: 14982
Gerrit-PatchSet: 2
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200923/afe10498/attachment.html>


More information about the asterisk-code-review mailing list