summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-01-22 15:38:07 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-22 15:00:21 +0000
commit8b7975b6aa31244faa8c8118aecc10de398f34f4 (patch)
tree9874badb007fb6d603b597ecf919f14349717715
parentbd33a9568e0d8e7fca6f4cbbaa224277ed1c3fef (diff)
socket: fix socket leak in osmo_sock_local_ip()
The socket that is opend to probe the correct local ip-address is not closed when the test is done. - Close socket when it is not needed anymore Change-Id: I7f3562a344b58f6298d2068314be1626a96e1b1d
-rw-r--r--src/socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index 82ccfed5..35cce643 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -827,6 +827,7 @@ int osmo_sock_local_ip(char *local_ip, const char *remote_ip)
memset(&local_addr, 0, sizeof(local_addr));
local_addr_len = sizeof(local_addr);
rc = getsockname(sfd, (struct sockaddr *)&local_addr, &local_addr_len);
+ close(sfd);
if (rc < 0)
return -EINVAL;
if (local_addr.sin_family == AF_INET)