res_pjsip_transport_websocket: Add NULL check in get_write_timeout
authorJørgen H <asterisk.org@hovland.cx>
Thu, 8 Jun 2017 22:31:47 +0000 (22:31 +0000)
committerRichard Mudgett <rmudgett@digium.com>
Fri, 9 Jun 2017 14:55:44 +0000 (09:55 -0500)
Added check for NULL return value when calling
ast_sorcery_retrieve_by_id in function get_write_timeout

ASTERISK-27046

Change-Id: I9357717278da631c3a1cb502c412693929b0cb41

res/res_pjsip_transport_websocket.c

index b3e63fc..cdda8c1 100644 (file)
@@ -302,10 +302,14 @@ static int get_write_timeout(void)
 
                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);