From 7c7175337b051e0eac0c26e2d5c328abea0f77c8 Mon Sep 17 00:00:00 2001 From: hdfan2 Date: Thu, 7 Aug 2025 10:20:07 +0500 Subject: [PATCH] p11_load.c: fixed crash when loaded dll initializes with error --- src/p11_load.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p11_load.c b/src/p11_load.c index d3888edb..55ddcd9e 100644 --- a/src/p11_load.c +++ b/src/p11_load.c @@ -144,7 +144,7 @@ void pkcs11_CTX_unload(PKCS11_CTX *ctx) { PKCS11_CTX_private *cpriv = PRIVCTX(ctx); - if (!cpriv->method) /* Module not loaded */ + if (!cpriv->method || !cpriv->handle) /* Module not loaded */ return; /* Tell the PKCS11 library to shut down */