]> git.meshlink.io Git - meshlink/commitdiff
Fix a memory leak when retrying outgoing connections.
authorGuus Sliepen <guus@meshlink.io>
Fri, 9 Oct 2015 20:47:55 +0000 (22:47 +0200)
committerGuus Sliepen <guus@meshlink.io>
Sun, 25 Jun 2017 08:16:37 +0000 (10:16 +0200)
When retry_outgoing_handler() calls setup_outgoing_connection(), it can
be that the old configuration is still in memory. So clean that up
before reading in new configuration data.

src/net_socket.c

index 55e7d31540a9188a5d4df13f73bcbde19d2cd121..0639478102df0d6cbe8ff47d69fac7809a611230 100644 (file)
@@ -522,6 +522,7 @@ void setup_outgoing_connection(meshlink_handle_t *mesh, outgoing_t *outgoing) {
                return;
        }
 
+       exit_configuration(&outgoing->config_tree); // discard old configuration if present
        init_configuration(&outgoing->config_tree);
        read_host_config(mesh, outgoing->config_tree, outgoing->name);
        outgoing->cfg = lookup_config(outgoing->config_tree, "Address");