summaryrefslogtreecommitdiff
path: root/src/common/tortls.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-05 21:19:53 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-05 21:19:53 +0000
commit339f09405608ac5277fc0f43f459352967e7803d (patch)
treecc5d0348b4046acd4b81ef3cf5a881663da1b80b /src/common/tortls.c
parenta34550667298dcff6cbd7333288d71808b800b33 (diff)
downloadtor-339f09405608ac5277fc0f43f459352967e7803d.tar.gz
tor-339f09405608ac5277fc0f43f459352967e7803d.zip
Refactor some code and add some asserts based on scanner results.
svn:r16783
Diffstat (limited to 'src/common/tortls.c')
-rw-r--r--src/common/tortls.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 67c68fe6d4..1032a53f25 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -521,7 +521,6 @@ int
tor_tls_context_new(crypto_pk_env_t *identity, unsigned int key_lifetime)
{
crypto_pk_env_t *rsa = NULL;
- crypto_dh_env_t *dh = NULL;
EVP_PKEY *pkey = NULL;
tor_tls_context_t *result = NULL;
X509 *cert = NULL, *idcert = NULL;
@@ -597,9 +596,11 @@ tor_tls_context_new(crypto_pk_env_t *identity, unsigned int key_lifetime)
pkey = NULL;
if (!SSL_CTX_check_private_key(result->ctx))
goto error;
- dh = crypto_dh_new();
- SSL_CTX_set_tmp_dh(result->ctx, _crypto_dh_env_get_dh(dh));
- crypto_dh_free(dh);
+ {
+ crypto_dh_env_t *dh = crypto_dh_new();
+ SSL_CTX_set_tmp_dh(result->ctx, _crypto_dh_env_get_dh(dh));
+ crypto_dh_free(dh);
+ }
SSL_CTX_set_verify(result->ctx, SSL_VERIFY_PEER,
always_accept_verify_cb);
/* let us realloc bufs that we're writing from */
@@ -625,8 +626,6 @@ tor_tls_context_new(crypto_pk_env_t *identity, unsigned int key_lifetime)
EVP_PKEY_free(pkey);
if (rsa)
crypto_free_pk_env(rsa);
- if (dh)
- crypto_dh_free(dh);
if (result)
tor_tls_context_decref(result);
if (cert)