X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconnection.c;h=7999b6fb08a28ef1146324f2890f11f93f43ff57;hb=ce059e36fdb3d3049c278e8b2f36b03c93778996;hp=fafec5db7e85e8e5b4a50b7d0da7990146a4e1a3;hpb=d6388d782ede1bbe49a5c2643362e2e0f383fa89;p=tinc diff --git a/src/connection.c b/src/connection.c index fafec5db..7999b6fb 100644 --- a/src/connection.c +++ b/src/connection.c @@ -54,7 +54,10 @@ connection_t *new_connection(void) { return xmalloc_and_zero(sizeof(connection_t)); } -void free_connection_partially(connection_t *c) { +void free_connection(connection_t *c) { + if(!c) + return; + cipher_close(&c->incipher); digest_close(&c->indigest); cipher_close(&c->outcipher); @@ -64,10 +67,7 @@ void free_connection_partially(connection_t *c) { ecdsa_free(&c->ecdsa); rsa_free(&c->rsa); - if(c->hischallenge) { - free(c->hischallenge); - c->hischallenge = NULL; - } + free(c->hischallenge); buffer_clear(&c->inbuf); buffer_clear(&c->outbuf); @@ -81,19 +81,6 @@ void free_connection_partially(connection_t *c) { if(c->socket > 0) closesocket(c->socket); - c->socket = -1; - - c->protocol_major = 0; - c->protocol_minor = 0; - c->allow_request = 0; -} - -void free_connection(connection_t *c) { - if(!c) - return; - - free_connection_partially(c); - free(c->name); free(c->hostname);