struct addrinfo *ai = NULL;
struct addrinfo *oai = NULL;
- for splay_each(edge_t, e, n->edge_tree) {
+ for splay_each(edge_t, e, &n->edge_tree) {
if(!e->reverse) {
continue;
}
static void free_known_addresses(struct addrinfo *ai) {
for(struct addrinfo *aip = ai, *next; aip; aip = next) {
next = aip->ai_next;
+ free(aip->ai_addr);
free(aip);
}
}
// Otherwise, check if there are any known Address statements
if(!cache->config_tree) {
- init_configuration(&cache->config_tree);
+ cache->config_tree = create_configuration();
read_host_config(cache->config_tree, cache->node->name, false);
cache->cfg = lookup_config(cache->config_tree, "Address");
}
- while(cache->cfg && !cache->ai) {
+ while(cache->cfg && !cache->aip) {
char *address, *port;
get_config_string(cache->cfg, &address);
}
}
+ if(cache->ai) {
+ free_known_addresses(cache->ai);
+ }
+
cache->aip = cache->ai = str2addrinfo(address, port, SOCK_STREAM);
if(cache->ai) {