diff options
Diffstat (limited to 'crypto/engine/tb_asnmth.c')
-rw-r--r-- | crypto/engine/tb_asnmth.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c index fb3953437a..fac038356b 100644 --- a/crypto/engine/tb_asnmth.c +++ b/crypto/engine/tb_asnmth.c @@ -205,8 +205,14 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_pkey_asn1_find_str(ENGINE **pe, return NULL; engine_table_doall(pkey_asn1_meth_table, look_str_cb, &fstr); /* If found obtain a structural reference to engine */ - if (fstr.e) { - fstr.e->struct_ref++; + if (fstr.e != NULL) { + int ref; + + if (!CRYPTO_UP_REF(&fstr.e->struct_ref, &ref, fstr.e->refcnt_lock)) { + CRYPTO_THREAD_unlock(global_engine_lock); + ERR_raise(ERR_LIB_ENGINE, ERR_R_CRYPTO_LIB); + return NULL; + } ENGINE_REF_PRINT(fstr.e, 0, 1); } *pe = fstr.e; |