summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbenno <benno@openbsd.org>2018-06-18 10:20:19 +0000
committerbenno <benno@openbsd.org>2018-06-18 10:20:19 +0000
commit85b76f6664a6c160d8379a7455b65d4a78ce8bc9 (patch)
tree41cc0da934b21eb1f31b2341c5b7431685d5eb23
parentpoint readers to multicast(4) directly, the documentation has moved. (diff)
downloadwireguard-openbsd-85b76f6664a6c160d8379a7455b65d4a78ce8bc9.tar.xz
wireguard-openbsd-85b76f6664a6c160d8379a7455b65d4a78ce8bc9.zip
fix memory leak: freeaddrinfo() the data from getaddrinfo().
From Thomas Barabosch <thomas DOT barabosch AT fkie DOT fraunhofer DOT de> Thanks. ok jca@
-rw-r--r--usr.sbin/ikectl/parser.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/ikectl/parser.c b/usr.sbin/ikectl/parser.c
index 52488845fd3..05baadb93c9 100644
--- a/usr.sbin/ikectl/parser.c
+++ b/usr.sbin/ikectl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.16 2016/06/14 13:45:40 reyk Exp $ */
+/* $OpenBSD: parser.c,v 1.17 2018/06/18 10:20:19 benno Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -273,6 +273,7 @@ parse_addr(const char *word)
hints.ai_family = PF_UNSPEC;
hints.ai_flags = AI_NUMERICHOST;
if (getaddrinfo(word, "0", &hints, &r) == 0) {
+ freeaddrinfo(r);
return (0);
}
@@ -327,7 +328,6 @@ match_token(char *word, const struct token table[])
case ADDRESS:
case FQDN:
if (!match && word != NULL && strlen(word) > 0) {
- parse_addr(word);
res.host = strdup(word);
if (parse_addr(word) == 0)
res.htype = HOST_IPADDR;