Skip to content

Commit fe9d28d

Browse files
committed
Add PKCS11_FORCE_CLEANUP option to control shutdown behavior at exit
1 parent 3952112 commit fe9d28d

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ New in 0.4.14; unreleased
44
* Added support for the "pkcs11prov" provider with OpenSSL 3.0
55
(Małgorzata Olszówka)
66
* Removed support for OpenSSL older than 1.0.2 (Michał Trojnara)
7+
* Added PKCS11_FORCE_CLEANUP to force cleanup on exit and avoid memory leaks
8+
with certain PKCS#11 modules
79

810
New in 0.4.13; 2024-12-13; Michał Trojnara
911
* Increased maximum PIN length (Michał Trojnara)

src/util_uri.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ static int util_ctx_enumerate_slots_unlocked(UTIL_CTX *ctx)
150150
*/
151151
static void exit_callback(void)
152152
{
153+
const char *str = getenv("PKCS11_FORCE_CLEANUP");
154+
155+
if (str && (!strcmp(str, "1") || !strcasecmp(str, "yes")))
156+
return;
153157
g_shutdown_mode = 1;
154158
}
155159

0 commit comments

Comments
 (0)