X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fconnection.c;h=adecae8b82746d116c99727bd2ab21def9cdac44;hb=bcd1979454cd14087394f0c0a983205f6fbfcaf4;hp=dc4dad2d727a517781741f4e5801c689056ab62e;hpb=ea294dac41365a08a77b64c62c0ba630292d7a07;p=meshlink diff --git a/src/connection.c b/src/connection.c index dc4dad2d..adecae8b 100644 --- a/src/connection.c +++ b/src/connection.c @@ -35,8 +35,9 @@ void init_connections(meshlink_handle_t *mesh) { } void exit_connections(meshlink_handle_t *mesh) { - if(mesh->connections) + if(mesh->connections) { list_delete_list(mesh->connections); + } free_connection(mesh->everyone); @@ -49,8 +50,9 @@ connection_t *new_connection(void) { } void free_connection(connection_t *c) { - if(!c) + if(!c) { return; + } sptps_stop(&c->sptps); ecdsa_free(c->ecdsa); @@ -58,17 +60,16 @@ void free_connection(connection_t *c) { buffer_clear(&c->inbuf); buffer_clear(&c->outbuf); - if(c->io.cb) + if(c->io.cb) { abort(); + } - if(c->socket > 0) + if(c->socket > 0) { closesocket(c->socket); + } free(c->name); - if(c->config_tree) - exit_configuration(&c->config_tree); - free(c); }