CID:1301065 fix possible NULL

This commit is contained in:
Seven Du 2015-05-29 12:11:01 +08:00
parent 47f88e920d
commit 55462887e8
1 changed files with 5 additions and 3 deletions

View File

@ -225,9 +225,11 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj)
/* Get the remote address/port info */ /* Get the remote address/port info */
switch_socket_addr_get(&addr, SWITCH_TRUE, newsocket); switch_socket_addr_get(&addr, SWITCH_TRUE, newsocket);
switch_get_addr(ipbuf, sizeof(ipbuf), addr); if (addr) {
rsession->remote_address = switch_core_strdup(rsession->pool, ipbuf); switch_get_addr(ipbuf, sizeof(ipbuf), addr);
rsession->remote_port = switch_sockaddr_get_port(addr); rsession->remote_address = switch_core_strdup(rsession->pool, ipbuf);
rsession->remote_port = switch_sockaddr_get_port(addr);
}
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(rsession->uuid), SWITCH_LOG_INFO, "Rtmp connection from %s:%i\n", switch_log_printf(SWITCH_CHANNEL_UUID_LOG(rsession->uuid), SWITCH_LOG_INFO, "Rtmp connection from %s:%i\n",
rsession->remote_address, rsession->remote_port); rsession->remote_address, rsession->remote_port);
} }