free_connection_partially(): also reset remote protocol version infos
[tinc] / src / connection.c
index dd52448..29ad04e 100644 (file)
@@ -64,8 +64,10 @@ void free_connection_partially(connection_t *c) {
        ecdsa_free(&c->ecdsa);
        rsa_free(&c->rsa);
 
-       if(c->hischallenge)
+       if(c->hischallenge) {
                free(c->hischallenge);
+               c->hischallenge = NULL;
+       }
 
        buffer_clear(&c->inbuf);
        buffer_clear(&c->outbuf);
@@ -80,6 +82,10 @@ void free_connection_partially(connection_t *c) {
                closesocket(c->socket);
 
        c->socket = -1;
+
+       c->protocol_major = 0;
+       c->protocol_minor = 0;
+       c->allow_request = 0;
 }
 
 void free_connection(connection_t *c) {