2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

silence clang compiler warnings

This commit is contained in:
Mark Andrews
2014-05-02 10:02:27 +10:00
parent c0de0cd8d8
commit d26c36b1d9

View File

@@ -178,6 +178,7 @@ static int add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
int socktype, int port); int socktype, int port);
static void set_order(int, int (**)(const char *, int, struct addrinfo **, static void set_order(int, int (**)(const char *, int, struct addrinfo **,
int, int)); int, int));
static void _freeaddrinfo(struct addrinfo *ai);
#define FOUND_IPV4 0x1 #define FOUND_IPV4 0x1
#define FOUND_IPV6 0x2 #define FOUND_IPV6 0x2
@@ -339,7 +340,7 @@ getaddrinfo(const char *hostname, const char *servname,
if (family == AF_INET6 || family == 0) { if (family == AF_INET6 || family == 0) {
ai = ai_alloc(AF_INET6, sizeof(struct sockaddr_in6)); ai = ai_alloc(AF_INET6, sizeof(struct sockaddr_in6));
if (ai == NULL) { if (ai == NULL) {
freeaddrinfo(ai_list); _freeaddrinfo(ai_list);
return (EAI_MEMORY); return (EAI_MEMORY);
} }
ai->ai_socktype = socktype; ai->ai_socktype = socktype;
@@ -459,7 +460,7 @@ getaddrinfo(const char *hostname, const char *servname,
NI_NUMERICHOST) == 0) { NI_NUMERICHOST) == 0) {
ai->ai_canonname = strdup(nbuf); ai->ai_canonname = strdup(nbuf);
if (ai->ai_canonname == NULL) { if (ai->ai_canonname == NULL) {
freeaddrinfo(ai); _freeaddrinfo(ai);
return (EAI_MEMORY); return (EAI_MEMORY);
} }
} else { } else {
@@ -482,7 +483,7 @@ getaddrinfo(const char *hostname, const char *servname,
socktype, port); socktype, port);
if (err != 0) { if (err != 0) {
if (ai_list != NULL) { if (ai_list != NULL) {
freeaddrinfo(ai_list); _freeaddrinfo(ai_list);
ai_list = NULL; ai_list = NULL;
} }
break; break;
@@ -832,7 +833,7 @@ process_answer(isc_task_t *task, isc_event_t *event) {
error = EAI_NONAME; error = EAI_NONAME;
} else { } else {
if (trans->ai_sentinel.ai_next != NULL) { 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; 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() */ ai = ai_clone(*aip, AF_INET); /* don't use ai_clone() */
if (ai == NULL) { if (ai == NULL) {
freeaddrinfo(*aip); _freeaddrinfo(*aip);
return (EAI_MEMORY); return (EAI_MEMORY);
} }
@@ -1162,6 +1163,11 @@ add_ipv6(const char *hostname, int flags, struct addrinfo **aip,
/*% Free address info. */ /*% Free address info. */
void void
freeaddrinfo(struct addrinfo *ai) { freeaddrinfo(struct addrinfo *ai) {
_freeaddrinfo(ai);
}
static void
_freeaddrinfo(struct addrinfo *ai) {
struct addrinfo *ai_next; struct addrinfo *ai_next;
while (ai != NULL) { while (ai != NULL) {