diff options
Diffstat (limited to 'networking/netstat.c')
| -rw-r--r-- | networking/netstat.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/networking/netstat.c b/networking/netstat.c index 807800a62..d7afa8fdd 100644 --- a/networking/netstat.c +++ b/networking/netstat.c | |||
| @@ -391,7 +391,7 @@ static const char *get_sname(int port, const char *proto, int numeric) | |||
| 391 | 391 | ||
| 392 | static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int numeric) | 392 | static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int numeric) |
| 393 | { | 393 | { |
| 394 | char *host, *host_port; | 394 | char *host; |
| 395 | 395 | ||
| 396 | /* Code which used "*" for INADDR_ANY is removed: it's ambiguous | 396 | /* Code which used "*" for INADDR_ANY is removed: it's ambiguous |
| 397 | * in IPv6, while "0.0.0.0" is not. */ | 397 | * in IPv6, while "0.0.0.0" is not. */ |
| @@ -402,9 +402,8 @@ static char *ip_port_str(struct sockaddr *addr, int port, const char *proto, int | |||
| 402 | if (!host) | 402 | if (!host) |
| 403 | host = xmalloc_sockaddr2dotted_noport(addr); | 403 | host = xmalloc_sockaddr2dotted_noport(addr); |
| 404 | 404 | ||
| 405 | host_port = xasprintf("%s:%s", host, get_sname(htons(port), proto, numeric)); | 405 | xasprintf_inplace(host, "%s:%s", host, get_sname(htons(port), proto, numeric)); |
| 406 | free(host); | 406 | return host; |
| 407 | return host_port; | ||
| 408 | } | 407 | } |
| 409 | 408 | ||
| 410 | struct inet_params { | 409 | struct inet_params { |
