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
This commit is contained in:
Joshua C. Colp 2020-09-22 07:13:32 -03:00 committed by Joshua Colp
parent f7285140b4
commit e6ed74347c
1 changed files with 1 additions and 1 deletions

View File

@ -5238,7 +5238,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 */