X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fconnection.c;h=d137af12f796142d3eeee267cdc5016e82cb6b84;hp=d27e6fd3ca72dee5c2cb362ba75eb18c70da8928;hb=b1b5cbc597088393e25d633e76d6456c7572e06c;hpb=07ace0b6481efcc0a058aab7b90b95edd31709da diff --git a/src/connection.c b/src/connection.c index d27e6fd3..d137af12 100644 --- a/src/connection.c +++ b/src/connection.c @@ -28,7 +28,7 @@ #include "utils.h" #include "xalloc.h" -avl_tree_t *connection_tree; /* Meta connections */ +avl_tree_t *connection_tree; /* Meta connections */ connection_t *everyone; static int connection_compare(const connection_t *a, const connection_t *b) { @@ -52,8 +52,9 @@ connection_t *new_connection(void) { c = xmalloc_and_zero(sizeof(connection_t)); - if(!c) + if(!c) { return NULL; + } gettimeofday(&c->start, NULL); @@ -95,13 +96,13 @@ void free_connection_partially(connection_t *c) { c->outbudget = 0; if(c->inctx) { - EVP_CIPHER_CTX_cleanup(c->inctx); + EVP_CIPHER_CTX_reset(c->inctx); free(c->inctx); c->inctx = NULL; } if(c->outctx) { - EVP_CIPHER_CTX_cleanup(c->outctx); + EVP_CIPHER_CTX_reset(c->outctx); free(c->outctx); c->outctx = NULL; } @@ -118,8 +119,9 @@ void free_connection(connection_t *c) { free(c->name); free(c->hostname); - if(c->config_tree) + if(c->config_tree) { exit_configuration(&c->config_tree); + } free(c); } @@ -141,8 +143,8 @@ void dump_connections(void) { for(node = connection_tree->head; node; node = node->next) { c = node->data; logger(LOG_DEBUG, " %s at %s options %x socket %d status %04x outbuf %d/%d/%d", - c->name, c->hostname, c->options, c->socket, bitfield_to_int(&c->status, sizeof c->status), - c->outbufsize, c->outbufstart, c->outbuflen); + c->name, c->hostname, c->options, c->socket, bitfield_to_int(&c->status, sizeof(c->status)), + c->outbufsize, c->outbufstart, c->outbuflen); } logger(LOG_DEBUG, "End of connections.");