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

Joshua Colp asteriskteam at digium.com
Tue Sep 22 05:16:34 CDT 2020


Joshua Colp has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/14933 )


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/33/14933/1

diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 19e0528..0091113 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -5238,7 +5238,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/+/14933
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I430fa721b0a824311a59effec6056e9ec528e3e8
Gerrit-Change-Number: 14933
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200922/934e4928/attachment-0001.html>


More information about the asterisk-code-review mailing list