aboutsummaryrefslogtreecommitdiffstats
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 16:42:49 +0200
commit40d8c08b8959aba92816a64573fefb18b7c4fd85 (patch)
tree23b47042c8e970cc579a5c993797d2d9ed40bac3
parent3a8fb39d6d91d5e7e7ac5ef649ba74977fcede3e (diff)
lib/tunc.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
-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;
}