From 55462887e8ae111898419d88c1394ac26b8708d2 Mon Sep 17 00:00:00 2001 From: Seven Du Date: Fri, 29 May 2015 12:11:01 +0800 Subject: [PATCH] CID:1301065 fix possible NULL --- src/mod/endpoints/mod_rtmp/rtmp_tcp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_rtmp/rtmp_tcp.c b/src/mod/endpoints/mod_rtmp/rtmp_tcp.c index c4288a4c3b..0b7264ebcb 100644 --- a/src/mod/endpoints/mod_rtmp/rtmp_tcp.c +++ b/src/mod/endpoints/mod_rtmp/rtmp_tcp.c @@ -225,9 +225,11 @@ void *SWITCH_THREAD_FUNC rtmp_io_tcp_thread(switch_thread_t *thread, void *obj) /* Get the remote address/port info */ switch_socket_addr_get(&addr, SWITCH_TRUE, newsocket); - switch_get_addr(ipbuf, sizeof(ipbuf), addr); - rsession->remote_address = switch_core_strdup(rsession->pool, ipbuf); - rsession->remote_port = switch_sockaddr_get_port(addr); + if (addr) { + switch_get_addr(ipbuf, sizeof(ipbuf), 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", rsession->remote_address, rsession->remote_port); }