aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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-12 18:00:16 +0200
commit58c0da7833b87cd67aee78cc0159102d70f36be3 (patch)
tree6a90bc41ce71fa842058a325863fb0a3c2b14f16 /lib
parent958256f5cfd19610ecec8b1130f726b7a6bb17fc (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')
-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;
}