Make sure resolved addressed for outgoing connections are freed, if there are any.

This commit is contained in:
Guus Sliepen 2006-11-29 16:57:46 +00:00
parent 5c69c390a1
commit 1bb5a284fe
2 changed files with 10 additions and 3 deletions

View file

@ -463,7 +463,8 @@ int main_loop(void)
if(c->outgoing) {
free(c->outgoing->name);
freeaddrinfo(c->outgoing->ai);
if(c->outgoing->ai)
freeaddrinfo(c->outgoing->ai);
free(c->outgoing);
c->outgoing = NULL;
}

View file

@ -572,8 +572,14 @@ void close_network_connections(void)
next = node->next;
c = node->data;
if(c->outgoing)
free(c->outgoing->name), free(c->outgoing), c->outgoing = NULL;
if(c->outgoing) {
if(c->outgoing->ai)
freeaddrinfo(c->outgoing->ai);
free(c->outgoing->name);
free(c->outgoing);
c->outgoing = NULL;
}
terminate_connection(c, false);
}