Fix crash when handling the ALRM signal.
authorGuus Sliepen <guus@tinc-vpn.org>
Tue, 26 Jun 2012 12:22:57 +0000 (14:22 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Tue, 26 Jun 2012 12:22:57 +0000 (14:22 +0200)
In retry() the function do_outgoing_connection() is called, which can delete
items from the connection_tree, so when walking the tree we must first save the
pointer to the next item.

src/net.c

index 295546df6068a5e63e2c4701d2d5c56d94f4a650..863dd762c326c885312a88d703f157f2ae4fc0ed 100644 (file)
--- a/src/net.c
+++ b/src/net.c
@@ -341,9 +341,10 @@ int reload_configuration(void) {
 
 void retry(void) {
        connection_t *c;
-       splay_node_t *node;
+       splay_node_t *node, *next;
 
-       for(node = connection_tree->head; node; node = node->next) {
+       for(node = connection_tree->head; node; node = next) {
+               next = node->next;
                c = node->data;
                
                if(c->outgoing && !c->node) {