diff options
Diffstat (limited to 'crypto/engine/eng_lib.c')
-rw-r--r-- | crypto/engine/eng_lib.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c index e80d77d6e3..3bb89111ff 100644 --- a/crypto/engine/eng_lib.c +++ b/crypto/engine/eng_lib.c @@ -35,15 +35,13 @@ ENGINE *ENGINE_new(void) } if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) return NULL; - ret->struct_ref = 1; - ENGINE_REF_PRINT(ret, 0, 1); - ret->refcnt_lock = CRYPTO_THREAD_lock_new(); - if (ret->refcnt_lock == NULL) { + if (!CRYPTO_NEW_REF(&ret->struct_ref, 1)) { OPENSSL_free(ret); return NULL; } + ENGINE_REF_PRINT(ret, 0, 1); if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data)) { - CRYPTO_THREAD_lock_free(ret->refcnt_lock); + CRYPTO_FREE_REF(&ret->struct_ref); OPENSSL_free(ret); return NULL; } @@ -82,7 +80,7 @@ int engine_free_util(ENGINE *e, int not_locked) if (e == NULL) return 1; - CRYPTO_DOWN_REF(&e->struct_ref, &i, e->refcnt_lock); + CRYPTO_DOWN_REF(&e->struct_ref, &i); ENGINE_REF_PRINT(e, 0, -1); if (i > 0) return 1; @@ -98,7 +96,7 @@ int engine_free_util(ENGINE *e, int not_locked) e->destroy(e); engine_remove_dynamic_id(e, not_locked); CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data); - CRYPTO_THREAD_lock_free(e->refcnt_lock); + CRYPTO_FREE_REF(&e->struct_ref); OPENSSL_free(e); return 1; } |