-void free_connection_partially(connection_t *c) {
- cipher_close(&c->incipher);
- digest_close(&c->indigest);
- cipher_close(&c->outcipher);
- digest_close(&c->outdigest);
+void free_connection(connection_t *c) {
+ if(!c)
+ return;
+
+#ifndef DISABLE_LEGACY
+ cipher_close(c->incipher);
+ digest_close(c->indigest);
+ cipher_close(c->outcipher);
+ digest_close(c->outdigest);
+ rsa_free(c->rsa);
+#endif