From: Guus Sliepen Date: Wed, 29 Nov 2006 16:57:46 +0000 (+0000) Subject: Make sure resolved addressed for outgoing connections are freed, if there are any. X-Git-Tag: release-1.0.6~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1bb5a284fec8c538f8ba243d4f9b2e46f68cd7e8;p=oweals%2Ftinc.git Make sure resolved addressed for outgoing connections are freed, if there are any. --- diff --git a/src/net.c b/src/net.c index e834f92..31f1b0e 100644 --- a/src/net.c +++ b/src/net.c @@ -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; } diff --git a/src/net_setup.c b/src/net_setup.c index ccd600b..f53127b 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -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); }