[Asterisk-code-review] res pjsip transport websocket: Add NULL check in get write t... (asterisk[14])

Kevin Harwell asteriskteam at digium.com
Wed Jun 14 09:54:36 CDT 2017


Kevin Harwell has uploaded this change for review. ( https://gerrit.asterisk.org/5832


Change subject: res_pjsip_transport_websocket: Add NULL check in get_write_timeout
......................................................................

res_pjsip_transport_websocket: Add NULL check in get_write_timeout

Added check for NULL return value when calling
ast_sorcery_retrieve_by_id in function get_write_timeout

ASTERISK-27046

Change-Id: I9357717278da631c3a1cb502c412693929b0cb41
---
M res/res_pjsip_transport_websocket.c
1 file changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/32/5832/1

diff --git a/res/res_pjsip_transport_websocket.c b/res/res_pjsip_transport_websocket.c
index b3e63fc..cdda8c1 100644
--- a/res/res_pjsip_transport_websocket.c
+++ b/res/res_pjsip_transport_websocket.c
@@ -302,10 +302,14 @@
 
 		for (; (transport_state = ao2_iterator_next(&it_transport_states)); ao2_cleanup(transport_state)) {
 			struct ast_sip_transport *transport;
+
 			if (transport_state->type != AST_TRANSPORT_WS && transport_state->type != AST_TRANSPORT_WSS) {
 				continue;
 			}
 			transport = ast_sorcery_retrieve_by_id(ast_sip_get_sorcery(), "transport", transport_state->id);
+			if (!transport) {
+				continue;
+			}
 			ast_debug(5, "Found %s transport with write timeout: %d\n",
 				transport->type == AST_TRANSPORT_WS ? "WS" : "WSS",
 				transport->write_timeout);

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

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9357717278da631c3a1cb502c412693929b0cb41
Gerrit-Change-Number: 5832
Gerrit-PatchSet: 1
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Jørgen H <asterisk.org at hovland.cx>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170614/7fac7315/attachment.html>


More information about the asterisk-code-review mailing list