Fix a possible crash when sending the HUP signal.
[oweals/tinc.git] / src / net_setup.c
index a08981f96b64679925defcf16e3bdc41bad15532..cbf631f5f211b61ccc545e3676c097a0484689be 100644 (file)
@@ -541,10 +541,17 @@ void close_network_connections(void) {
        for(node = connection_tree->head; node; node = next) {
                next = node->next;
                c = node->data;
-               c->outgoing = false;
+               c->outgoing = NULL;
                terminate_connection(c, false);
        }
 
+       for(list_node_t *node = outgoing_list->head; node; node = node->next) {
+               outgoing_t *outgoing = node->data;
+
+               if(outgoing->event)
+                       event_del(outgoing->event);
+       }
+
        list_delete_list(outgoing_list);
 
        if(myself && myself->connection) {