summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_kmeth.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ec/ec_kmeth.c')
-rw-r--r--crypto/ec/ec_kmeth.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/crypto/ec/ec_kmeth.c b/crypto/ec/ec_kmeth.c
index eca531d2b3..ec68ab154e 100644
--- a/crypto/ec/ec_kmeth.c
+++ b/crypto/ec/ec_kmeth.c
@@ -93,12 +93,8 @@ EC_KEY *ossl_ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
goto err;
}
- ret->references = 1;
- ret->lock = CRYPTO_THREAD_lock_new();
- if (ret->lock == NULL) {
- ERR_raise(ERR_LIB_EC, ERR_R_CRYPTO_LIB);
+ if (!CRYPTO_NEW_REF(&ret->references, 1))
goto err;
- }
ret->meth = EC_KEY_get_default_method();
#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
@@ -137,6 +133,7 @@ EC_KEY *ossl_ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
return ret;
err:
+ CRYPTO_FREE_REF(&ret->references);
EC_KEY_free(ret);
return NULL;
}