A couple missed tevent things.
[tinc] / src / net_setup.c
index ccd600b..0c399bb 100644 (file)
@@ -32,7 +32,7 @@
 #include "conf.h"
 #include "connection.h"
 #include "device.h"
-#include "event.h"
+#include "tevent.h"
 #include "graph.h"
 #include "logger.h"
 #include "net.h"
@@ -526,7 +526,7 @@ bool setup_network_connections(void)
 
        now = time(NULL);
 
-       init_events();
+       init_tevents();
        init_connections();
        init_subnets();
        init_nodes();
@@ -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);
        }
 
@@ -598,7 +604,7 @@ void close_network_connections(void)
        exit_subnets();
        exit_nodes();
        exit_connections();
-       exit_events();
+       exit_tevents();
 
        execute_script("tinc-down", envp);