diff options
author | Hans Nilsson <[email protected]> | 2018-06-04 12:10:01 +0200 |
---|---|---|
committer | Hans Nilsson <[email protected]> | 2018-06-04 12:10:01 +0200 |
commit | 26a9bce58050e0de68923daff601ea639d137659 (patch) | |
tree | 0bdd7e4a1db6d6b4e9789fb33c287e405cf4575a /lib | |
parent | 0d995574f86dd2c6ba42a8da03da3ddb5e372a48 (diff) | |
parent | a9c7e47957c77b74f2b2261ad79a4f0f257dfbf7 (diff) | |
download | otp-26a9bce58050e0de68923daff601ea639d137659.tar.gz otp-26a9bce58050e0de68923daff601ea639d137659.tar.bz2 otp-26a9bce58050e0de68923daff601ea639d137659.zip |
Merge branch 'hans/crypto/EVP_DH_key/OTP-14864'
* hans/crypto/EVP_DH_key/OTP-14864:
crypto: Valgrind suggestions
Diffstat (limited to 'lib')
-rw-r--r-- | lib/crypto/c_src/crypto.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c index 6e113ef39e..2c69dbb5ff 100644 --- a/lib/crypto/c_src/crypto.c +++ b/lib/crypto/c_src/crypto.c @@ -3071,10 +3071,11 @@ static ERL_NIF_TERM dh_generate_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_ if ((dhkey = EVP_PKEY_new()) && (params = EVP_PKEY_new()) && EVP_PKEY_set1_DH(params, dh_params) /* set the key referenced by params to dh_params. - dh_params (and params) must be freed by us*/ + dh_params (and params) must be freed */ && (ctx = EVP_PKEY_CTX_new(params, NULL)) && EVP_PKEY_keygen_init(ctx) - && EVP_PKEY_keygen(ctx, &dhkey) + && EVP_PKEY_keygen(ctx, &dhkey) /* "performs a key generation operation, the + generated key is written to ppkey." (=last arg) */ && (dh_params = EVP_PKEY_get1_DH(dhkey)) /* return the referenced key. dh_params and dhkey must be freed */ ) { #else @@ -3108,8 +3109,8 @@ static ERL_NIF_TERM dh_generate_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_ DH_free(dh_params); #ifdef HAS_EVP_PKEY_CTX if (ctx) EVP_PKEY_CTX_free(ctx); - /* if (dhkey) EVP_PKEY_free(dhkey); */ - /* if (params) EVP_PKEY_free(params); */ + if (dhkey) EVP_PKEY_free(dhkey); + if (params) EVP_PKEY_free(params); #endif return ret; } @@ -3207,7 +3208,7 @@ static ERL_NIF_TERM dh_compute_key_nif(ErlNifEnv* env, int argc, const ERL_NIF_T if (dh_pub) DH_free(dh_pub); #ifdef HAS_EVP_PKEY_CTX if (ctx) EVP_PKEY_CTX_free(ctx); - /* if (my_priv_key) EVP_PKEY_free(my_priv_key); */ + if (my_priv_key) EVP_PKEY_free(my_priv_key); /* if (peer_pub_key) EVP_PKEY_free(peer_pub_key); */ #endif return ret; |