diff options
author | Geoff Thorpe <geoff@openssl.org> | 2001-04-02 17:21:36 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2001-04-02 17:21:36 +0000 |
commit | e4dc18d7e5bc46cb8909e4b12e87cda0b262892f (patch) | |
tree | 7b1eec319c2e29f2c571c48ca5d19ac7d437b72b /crypto/engine | |
parent | 3f86a2b147e6f0ed0a149fa48706cbb6d95bb4b8 (diff) |
Actually there were two error cases that could return without releasing the
lock - stupidly, my last change addressed only one of them.
Diffstat (limited to 'crypto/engine')
-rw-r--r-- | crypto/engine/engine_lib.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/engine/engine_lib.c b/crypto/engine/engine_lib.c index 781494d1a9..99b031fe96 100644 --- a/crypto/engine/engine_lib.c +++ b/crypto/engine/engine_lib.c @@ -288,20 +288,21 @@ EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id, int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) { - int ctrl_exists; + int ctrl_exists, ref_exists; if(e == NULL) { ENGINEerr(ENGINE_F_ENGINE_CTRL,ERR_R_PASSED_NULL_PARAMETER); return 0; } CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); - if(e->struct_ref == 0) + ref_exists = ((e->struct_ref > 0) ? 1 : 0); + ctrl_exists = (e->ctrl ? 1 : 0); + CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); + if(!ref_exists) { ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NO_REFERENCE); return 0; } - ctrl_exists = (e->ctrl ? 1 : 0); - CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE); if (!ctrl_exists) { ENGINEerr(ENGINE_F_ENGINE_CTRL,ENGINE_R_NO_CONTROL_FUNCTION); |