summaryrefslogtreecommitdiffstats
path: root/crypto/engine/eng_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/engine/eng_lib.c')
-rw-r--r--crypto/engine/eng_lib.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c
index 5285200107..40e0413a26 100644
--- a/crypto/engine/eng_lib.c
+++ b/crypto/engine/eng_lib.c
@@ -28,11 +28,13 @@ ENGINE *ENGINE_new(void)
{
ENGINE *ret;
- if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)
- || (ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
- ERR_raise(ERR_LIB_ENGINE, ERR_R_MALLOC_FAILURE);
- return NULL;
+ if (!RUN_ONCE(&engine_lock_init, do_engine_lock_init)) {
+ /* Maybe this should be raised in do_engine_lock_init() */
+ ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
+ return 0;
}
+ if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
+ return NULL;
ret->struct_ref = 1;
ENGINE_REF_PRINT(ret, 0, 1);
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_ENGINE, ret, &ret->ex_data)) {
@@ -125,10 +127,8 @@ static ENGINE_CLEANUP_ITEM *int_cleanup_item(ENGINE_CLEANUP_CB *cb)
{
ENGINE_CLEANUP_ITEM *item;
- if ((item = OPENSSL_malloc(sizeof(*item))) == NULL) {
- ERR_raise(ERR_LIB_ENGINE, ERR_R_MALLOC_FAILURE);
+ if ((item = OPENSSL_malloc(sizeof(*item))) == NULL)
return NULL;
- }
item->cb = cb;
return item;
}