summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-09-05 20:18:22 +0000
committerNick Mathewson <nickm@torproject.org>2008-09-05 20:18:22 +0000
commit4d94e061c7a1af2fbb92ab3114c3ce5f59971a31 (patch)
treea2773164514b4e591338dddb0cab58df5e04b66a /src/common
parenta56a072f296627eba190e83f96f5ca087358a14b (diff)
downloadtor-4d94e061c7a1af2fbb92ab3114c3ce5f59971a31.tar.gz
tor-4d94e061c7a1af2fbb92ab3114c3ce5f59971a31.zip
Clean up some redundant stuff in crypto_dh_new().
svn:r16778
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index b158967a35..e1b4012138 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -1465,13 +1465,11 @@ init_dh_param(void)
crypto_dh_env_t *
crypto_dh_new(void)
{
- crypto_dh_env_t *res = NULL;
+ crypto_dh_env_t *res = tor_malloc_zero(sizeof(crypto_dh_env_t));
if (!dh_param_p)
init_dh_param();
- res = tor_malloc_zero(sizeof(crypto_dh_env_t));
-
if (!(res->dh = DH_new()))
goto err;
@@ -1486,8 +1484,8 @@ crypto_dh_new(void)
return res;
err:
crypto_log_errors(LOG_WARN, "creating DH object");
- if (res && res->dh) DH_free(res->dh); /* frees p and g too */
- if (res) tor_free(res);
+ if (res->dh) DH_free(res->dh); /* frees p and g too */
+ tor_free(res);
return NULL;
}