diff options
author | Sebastian Benoit <benno@cvs.openbsd.org> | 2018-06-17 18:07:19 +0000 |
---|---|---|
committer | Sebastian Benoit <benno@cvs.openbsd.org> | 2018-06-17 18:07:19 +0000 |
commit | a2af34bda402998a39b159fc95e65d1cb263d7fc (patch) | |
tree | 6661413e38d2e1e707a18c5910619b53bce0da2f | |
parent | 24c101097c30c906019f6a77a5f0906609638206 (diff) |
fix memory leaks: freeaddrinfo() the data from getaddrinfo().
From Thomas Barabosch <thomas DOT barabosch AT fkie DOT fraunhofer DOT de>
Thanks.
ok florian@
-rw-r--r-- | usr.sbin/ndp/ndp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/ndp/ndp.c b/usr.sbin/ndp/ndp.c index 4fed6b404a7..ff142525133 100644 --- a/usr.sbin/ndp/ndp.c +++ b/usr.sbin/ndp/ndp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ndp.c,v 1.88 2018/04/26 12:42:51 guenther Exp $ */ +/* $OpenBSD: ndp.c,v 1.89 2018/06/17 18:07:18 benno Exp $ */ /* $KAME: ndp.c,v 1.101 2002/07/17 08:46:33 itojun Exp $ */ /* @@ -352,6 +352,7 @@ set(int argc, char **argv) htons(((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id); } #endif + freeaddrinfo(res); ea = (u_char *)LLADDR(&sdl_m); if (ndp_ether_aton(eaddr, ea) == 0) sdl_m.sdl_alen = 6; @@ -426,6 +427,7 @@ get(char *host) htons(((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id); } #endif + freeaddrinfo(res); dump(&sin->sin6_addr, 0); if (found_entry == 0) { getnameinfo((struct sockaddr *)sin, sin->sin6_len, host_buf, @@ -468,7 +470,7 @@ delete(char *host) htons(((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id); } #endif - + freeaddrinfo(res); if (rtget(&sin, &sdl)) { errx(1, "RTM_GET(%s) failed", host); /* NOTREACHED */ |