aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tun.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2017-10-12 16:42:46 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2017-10-13 13:10:57 +0200
commit4a76d4bd5dd73eaafcfcdc30bef1703e35383977 (patch)
treefbe2794c7484c53714e093e6ebf621e2a8306ca2 /lib/tun.c
parent1d4a2f8cf40f33425a9ea364a27ecc00528a0337 (diff)
lib/tun.c: tun_ipv6_linklocal_get(): fix memory leak with getifaddrs()
From getifaddrs(3) man: "The data returned by getifaddrs() is dynamically allocated and should be freed using freeifaddrs() when no longer needed" Change-Id: If6300d1c8d36fcafef294a4c11bbda31a158bb9c
Diffstat (limited to 'lib/tun.c')
-rw-r--r--lib/tun.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/tun.c b/lib/tun.c
index 32a8d2d..35d371e 100644
--- a/lib/tun.c
+++ b/lib/tun.c
@@ -776,7 +776,9 @@ int tun_ipv6_linklocal_get(const struct tun_t *tun, struct in6_addr *ia)
continue;
*ia = sin6->sin6_addr;
+ freeifaddrs(ifaddr);
return 0;
}
+ freeifaddrs(ifaddr);
return -1;
}