diff options
Diffstat (limited to 'crypto/engine/eng_table.c')
-rw-r--r-- | crypto/engine/eng_table.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crypto/engine/eng_table.c b/crypto/engine/eng_table.c index be5704e93d..aa9b31aeff 100644 --- a/crypto/engine/eng_table.c +++ b/crypto/engine/eng_table.c @@ -86,7 +86,9 @@ int engine_table_register(ENGINE_TABLE **table, ENGINE_CLEANUP_CB *cleanup, { int ret = 0, added = 0; ENGINE_PILE tmplate, *fnd; - CRYPTO_THREAD_write_lock(global_engine_lock); + + if (!CRYPTO_THREAD_write_lock(global_engine_lock)) + return 0; if (!(*table)) added = 1; if (!int_table_check(table, 1)) @@ -161,7 +163,9 @@ IMPLEMENT_LHASH_DOALL_ARG(ENGINE_PILE, ENGINE); void engine_table_unregister(ENGINE_TABLE **table, ENGINE *e) { - CRYPTO_THREAD_write_lock(global_engine_lock); + if (!CRYPTO_THREAD_write_lock(global_engine_lock)) + /* Can't return a value. :( */ + return; if (int_table_check(table, 0)) lh_ENGINE_PILE_doall_ENGINE(&(*table)->piles, int_unregister_cb, e); CRYPTO_THREAD_unlock(global_engine_lock); @@ -179,7 +183,8 @@ static void int_cleanup_cb_doall(ENGINE_PILE *p) void engine_table_cleanup(ENGINE_TABLE **table) { - CRYPTO_THREAD_write_lock(global_engine_lock); + if (!CRYPTO_THREAD_write_lock(global_engine_lock)) + return; if (*table) { lh_ENGINE_PILE_doall(&(*table)->piles, int_cleanup_cb_doall); lh_ENGINE_PILE_free(&(*table)->piles); @@ -206,7 +211,8 @@ ENGINE *engine_table_select_int(ENGINE_TABLE **table, int nid, const char *f, return NULL; } ERR_set_mark(); - CRYPTO_THREAD_write_lock(global_engine_lock); + if (!CRYPTO_THREAD_write_lock(global_engine_lock)) + goto end; /* * Check again inside the lock otherwise we could race against cleanup * operations. But don't worry about a debug printout |