[Asterisk-code-review] res pjsip t38: Make t38 reinvite response cb tolerant of NU... (asterisk[15])

George Joseph asteriskteam at digium.com
Tue Sep 5 05:32:33 CDT 2017


George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/6386


Change subject: res_pjsip_t38:  Make t38_reinvite_response_cb tolerant of NULL channel
......................................................................

res_pjsip_t38:  Make t38_reinvite_response_cb tolerant of NULL channel

t38_reinvite_response_cb can get called by res_pjsip_session's
session_inv_on_tsx_state_changed in situations where session->channel
is NULL.  If it is, the ast_log warning segfaults because it tries
to get the channel name from a NULL channel.

* Check session->channel and print "unknown channel" when it's NULL.

ASTERISK-27236
Reported by: Ross Beer

Change-Id: I4326e288d36327f6c79ab52226d54905cdc87dc7
---
M res/res_pjsip_t38.c
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/86/6386/1

diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 27eff42..bb4a1d2 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -302,9 +302,10 @@
 	}
 
 	state = t38_state_get_or_alloc(session);
-	if (!state) {
+	if (!session->channel || !state) {
 		ast_log(LOG_WARNING, "Received response to T.38 re-invite on '%s' but state unavailable\n",
-			ast_channel_name(session->channel));
+			session->channel ? ast_channel_name(session->channel) : "unknown channel");
+		ao2_cleanup(session_media);
 		return 0;
 	}
 
@@ -334,6 +335,7 @@
 		ast_sip_session_media_state_reset(session->pending_media_state);
 	}
 
+	ao2_cleanup(session_media);
 	return 0;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/6386
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4326e288d36327f6c79ab52226d54905cdc87dc7
Gerrit-Change-Number: 6386
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170905/206f7364/attachment.html>


More information about the asterisk-code-review mailing list