summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-06-30 00:50:22 +0000
committerJun-ichiro itojun Hagino <itojun@cvs.openbsd.org>2001-06-30 00:50:22 +0000
commitf6440aeba924257548ab9f0394a02aede31a93c7 (patch)
tree782ee0507bcbcb3bd7dd2196dafc9e774051cbd1
parent982493741f77629ca38dd5d1639bddaa6855a3e2 (diff)
missing freeaddrinfo(). PR 1907
-rw-r--r--lib/libc/net/res_init.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c
index 5134323f4e8..d21eed4a878 100644
--- a/lib/libc/net/res_init.c
+++ b/lib/libc/net/res_init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_init.c,v 1.22 2001/06/27 00:58:55 lebel Exp $ */
+/* $OpenBSD: res_init.c,v 1.23 2001/06/30 00:50:21 itojun Exp $ */
/*
* ++Copyright++ 1985, 1989, 1993
@@ -64,7 +64,7 @@
static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
static char rcsid[] = "$From: res_init.c,v 8.7 1996/09/28 06:51:07 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_init.c,v 1.22 2001/06/27 00:58:55 lebel Exp $";
+static char rcsid[] = "$OpenBSD: res_init.c,v 1.23 2001/06/30 00:50:21 itojun Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -372,6 +372,7 @@ res_init()
hints.ai_flags = AI_NUMERICHOST;
hints.ai_socktype = SOCK_DGRAM;
snprintf(pbuf, sizeof(pbuf), "%d", NAMESERVER_PORT);
+ res = NULL;
if (getaddrinfo(cp, pbuf, &hints, &res) == 0 &&
res->ai_next == NULL) {
if (res->ai_addrlen <= sizeof(_res_ext.nsaddr_list[nserv])) {
@@ -390,6 +391,8 @@ res_init()
}
nserv++;
}
+ if (res)
+ freeaddrinfo(res);
#else /* INET6 */
if ((*cp != '\0') && (*cp != '\n') && inet_aton(cp, &a)) {
_res.nsaddr_list[nserv].sin_addr = a;