]> git.meshlink.io Git - meshlink/blobdiff - src/connection.c
Fix memory leaks from timers.
[meshlink] / src / connection.c
index dc4dad2d727a517781741f4e5801c689056ab62e..adecae8b82746d116c99727bd2ab21def9cdac44 100644 (file)
@@ -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);
 }