Be on the safe side with initialisation of c->name.
authorGuus Sliepen <guus@tinc-vpn.org>
Wed, 4 May 2005 15:51:45 +0000 (15:51 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Wed, 4 May 2005 15:51:45 +0000 (15:51 +0000)
src/net_socket.c
src/protocol_auth.c

index 9095d57..dbd09dd 100644 (file)
@@ -424,6 +424,7 @@ bool handle_new_meta_connection(int sock)
        sockaddrunmap(&sa);
 
        c = new_connection();
        sockaddrunmap(&sa);
 
        c = new_connection();
+       c->name = NULL;
        c->outcipher = myself->connection->outcipher;
        c->outdigest = myself->connection->outdigest;
        c->outmaclength = myself->connection->outmaclength;
        c->outcipher = myself->connection->outcipher;
        c->outdigest = myself->connection->outdigest;
        c->outmaclength = myself->connection->outmaclength;
@@ -462,8 +463,7 @@ void try_outgoing_connections(void)
 
        cp();
 
 
        cp();
 
-       for(cfg = lookup_config(config_tree, "ConnectTo"); cfg;
-               cfg = lookup_config_next(config_tree, cfg)) {
+       for(cfg = lookup_config(config_tree, "ConnectTo"); cfg; cfg = lookup_config_next(config_tree, cfg)) {
                get_config_string(cfg, &name);
 
                if(!check_id(name)) {
                get_config_string(cfg, &name);
 
                if(!check_id(name)) {
index 214d4dd..05f547f 100644 (file)
@@ -76,8 +76,11 @@ bool id_h(connection_t *c)
                                   c->name);
                        return false;
                }
                                   c->name);
                        return false;
                }
-       } else
+       } else {
+               if(c->name)
+                       free(c->name);
                c->name = xstrdup(name);
                c->name = xstrdup(name);
+       }
 
        /* Check if version matches */
 
 
        /* Check if version matches */