diff options
-rw-r--r-- | networking/netstat.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/networking/netstat.c b/networking/netstat.c index 33281e333..f6bcd44ba 100644 --- a/networking/netstat.c +++ b/networking/netstat.c | |||
@@ -397,8 +397,11 @@ static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int | |||
397 | /* Code which used "*" for INADDR_ANY is removed: it's ambiguous | 397 | /* Code which used "*" for INADDR_ANY is removed: it's ambiguous |
398 | * in IPv6, while "0.0.0.0" is not. */ | 398 | * in IPv6, while "0.0.0.0" is not. */ |
399 | 399 | ||
400 | host = numeric ? xmalloc_sockaddr2dotted_noport(addr) | 400 | host = NULL; |
401 | : xmalloc_sockaddr2host_noport(addr); | 401 | if (!numeric) |
402 | host = xmalloc_sockaddr2host_noport(addr); | ||
403 | if (!host) | ||
404 | host = xmalloc_sockaddr2dotted_noport(addr); | ||
402 | 405 | ||
403 | host_port = xasprintf("%s:%s", host, get_sname(htons(port), proto, numeric)); | 406 | host_port = xasprintf("%s:%s", host, get_sname(htons(port), proto, numeric)); |
404 | free(host); | 407 | free(host); |