summaryrefslogtreecommitdiffstats
path: root/crypto/engine/eng_list.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/engine/eng_list.c')
-rw-r--r--crypto/engine/eng_list.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/engine/eng_list.c b/crypto/engine/eng_list.c
index a2c151d64a..b46403e556 100644
--- a/crypto/engine/eng_list.c
+++ b/crypto/engine/eng_list.c
@@ -243,6 +243,7 @@ ENGINE *ENGINE_get_first(void)
int ref;
if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) {
+ CRYPTO_THREAD_unlock(global_engine_lock);
ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
return NULL;
}
@@ -269,6 +270,7 @@ ENGINE *ENGINE_get_last(void)
int ref;
if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) {
+ CRYPTO_THREAD_unlock(global_engine_lock);
ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
return NULL;
}
@@ -294,6 +296,7 @@ ENGINE *ENGINE_get_next(ENGINE *e)
/* Return a valid structural reference to the next ENGINE */
if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) {
+ CRYPTO_THREAD_unlock(global_engine_lock);
ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
return NULL;
}
@@ -320,6 +323,7 @@ ENGINE *ENGINE_get_prev(ENGINE *e)
/* Return a valid structural reference to the next ENGINE */
if (!CRYPTO_UP_REF(&ret->struct_ref, &ref)) {
+ CRYPTO_THREAD_unlock(global_engine_lock);
ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB);
return NULL;
}
@@ -404,7 +408,7 @@ static void engine_cpy(ENGINE *dest, const ENGINE *src)
ENGINE *ENGINE_by_id(const char *id)
{
ENGINE *iterator;
- char *load_dir = NULL;
+ const char *load_dir = NULL;
if (id == NULL) {
ERR_raise(ERR_LIB_ENGINE, ERR_R_PASSED_NULL_PARAMETER);
return NULL;
@@ -455,7 +459,7 @@ ENGINE *ENGINE_by_id(const char *id)
*/
if (strcmp(id, "dynamic")) {
if ((load_dir = ossl_safe_getenv("OPENSSL_ENGINES")) == NULL)
- load_dir = ENGINESDIR;
+ load_dir = ossl_get_enginesdir();
iterator = ENGINE_by_id("dynamic");
if (!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) ||
!ENGINE_ctrl_cmd_string(iterator, "DIR_LOAD", "2", 0) ||