Skip to content

Commit

Permalink
Added check in pkcs11_CTX_unload() to ensure the module is loaded bef…
Browse files Browse the repository at this point in the history
…ore attempting shutdown
  • Loading branch information
olszomal authored and mtrojnar committed Oct 25, 2024
1 parent f0d5a0d commit 55534b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/p11_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ void pkcs11_CTX_unload(PKCS11_CTX *ctx)
{
PKCS11_CTX_private *cpriv = PRIVCTX(ctx);

if (!cpriv->method) /* Module not loaded */
return;

/* Tell the PKCS11 library to shut down */
if (cpriv->forkid == get_forkid())
cpriv->method->C_Finalize(NULL);
Expand Down

0 comments on commit 55534b9

Please sign in to comment.