[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] Free tls resources on exit too



Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv27241/src/common

Modified Files:
	tortls.c tortls.h 
Log Message:
Free tls resources on exit too

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/tortls.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- tortls.c	3 Jan 2005 17:53:20 -0000	1.83
+++ tortls.c	11 Feb 2005 01:41:19 -0000	1.84
@@ -156,6 +156,17 @@
   }
 }
 
+void
+tor_tls_free_all(void)
+{
+  if (global_tls_context) {
+    SSL_CTX_free(global_tls_context->ctx);
+    SSL_CTX_free(global_tls_context->client_only_ctx);
+    tor_free(global_tls_context);
+    global_tls_context = NULL;
+  }
+}
+
 /** We need to give OpenSSL a callback to verify certificates. This is
  * it: We always accept peer certs and complete the handshake.  We
  * don't validate them until later.

Index: tortls.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/tortls.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- tortls.h	22 Dec 2004 02:32:26 -0000	1.23
+++ tortls.h	11 Feb 2005 01:41:19 -0000	1.24
@@ -24,6 +24,7 @@
 #define TOR_TLS_WANTWRITE   -1
 #define TOR_TLS_DONE         0
 
+void tor_tls_free_all(void);
 int tor_tls_context_new(crypto_pk_env_t *rsa, int isServer,
                         const char *nickname, unsigned int key_lifetime);
 tor_tls *tor_tls_new(int sock, int is_server, int use_no_cert);