From d26c36b1d95c52d17732530e73b7ba536ad32ffb Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 2 May 2014 10:02:27 +1000 Subject: [PATCH] silence clang compiler warnings --- lib/irs/getaddrinfo.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/irs/getaddrinfo.c b/lib/irs/getaddrinfo.c index a02705fdf3..cda7b18bff 100644 --- a/lib/irs/getaddrinfo.c +++ b/lib/irs/getaddrinfo.c @@ -178,6 +178,7 @@ static int add_ipv6(const char *hostname, int flags, struct addrinfo **aip, int socktype, int port); static void set_order(int, int (**)(const char *, int, struct addrinfo **, int, int)); +static void _freeaddrinfo(struct addrinfo *ai); #define FOUND_IPV4 0x1 #define FOUND_IPV6 0x2 @@ -339,7 +340,7 @@ getaddrinfo(const char *hostname, const char *servname, if (family == AF_INET6 || family == 0) { ai = ai_alloc(AF_INET6, sizeof(struct sockaddr_in6)); if (ai == NULL) { - freeaddrinfo(ai_list); + _freeaddrinfo(ai_list); return (EAI_MEMORY); } ai->ai_socktype = socktype; @@ -459,7 +460,7 @@ getaddrinfo(const char *hostname, const char *servname, NI_NUMERICHOST) == 0) { ai->ai_canonname = strdup(nbuf); if (ai->ai_canonname == NULL) { - freeaddrinfo(ai); + _freeaddrinfo(ai); return (EAI_MEMORY); } } else { @@ -482,7 +483,7 @@ getaddrinfo(const char *hostname, const char *servname, socktype, port); if (err != 0) { if (ai_list != NULL) { - freeaddrinfo(ai_list); + _freeaddrinfo(ai_list); ai_list = NULL; } break; @@ -832,7 +833,7 @@ process_answer(isc_task_t *task, isc_event_t *event) { error = EAI_NONAME; } else { if (trans->ai_sentinel.ai_next != NULL) { - freeaddrinfo(trans->ai_sentinel.ai_next); + _freeaddrinfo(trans->ai_sentinel.ai_next); trans->ai_sentinel.ai_next = NULL; } } @@ -1124,7 +1125,7 @@ add_ipv4(const char *hostname, int flags, struct addrinfo **aip, ai = ai_clone(*aip, AF_INET); /* don't use ai_clone() */ if (ai == NULL) { - freeaddrinfo(*aip); + _freeaddrinfo(*aip); return (EAI_MEMORY); } @@ -1162,6 +1163,11 @@ add_ipv6(const char *hostname, int flags, struct addrinfo **aip, /*% Free address info. */ void freeaddrinfo(struct addrinfo *ai) { + _freeaddrinfo(ai); +} + +static void +_freeaddrinfo(struct addrinfo *ai) { struct addrinfo *ai_next; while (ai != NULL) {