Skip to content

Commit

Permalink
Actually there were two error cases that could return without releasi…
Browse files Browse the repository at this point in the history
…ng the

lock - stupidly, my last change addressed only one of them.
  • Loading branch information
Geoff Thorpe committed Apr 2, 2001
1 parent 3f86a2b commit e4dc18d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crypto/engine/engine_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e4dc18d

Please sign in to comment.