From 557dbdf9fa4fe8b6407934401a4e978c0a114993 Mon Sep 17 00:00:00 2001 From: danielhjones Date: Mon, 1 May 2006 14:26:04 +0000 Subject: [PATCH] Closing spin lock file descriptor during SC_Finalize to prevent leaks on repeated C_Initialize/C_Finalize calls. --- usr/lib/pkcs11/common/new_host.c | 3 +++ usr/lib/pkcs11/tpm_stdll/new_host.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/usr/lib/pkcs11/common/new_host.c b/usr/lib/pkcs11/common/new_host.c index 2155e38d..6e4a8962 100755 --- a/usr/lib/pkcs11/common/new_host.c +++ b/usr/lib/pkcs11/common/new_host.c @@ -756,6 +756,9 @@ CK_RV SC_Finalize( CK_SLOT_ID sid ) session_mgr_close_all_sessions(); object_mgr_purge_token_objects(); detach_shm(); + // close spin lock file + if (spin_created) + close(spinxplfd); if ( token_specific.t_final != NULL) { token_specific.t_final(); } diff --git a/usr/lib/pkcs11/tpm_stdll/new_host.c b/usr/lib/pkcs11/tpm_stdll/new_host.c index 33694d7b..f65d7083 100644 --- a/usr/lib/pkcs11/tpm_stdll/new_host.c +++ b/usr/lib/pkcs11/tpm_stdll/new_host.c @@ -549,6 +549,9 @@ CK_RV SC_Finalize( CK_SLOT_ID sid ) object_mgr_purge_token_objects(); detach_shm(); + // close spin lock file + if (spin_created) + close(spinxplfd); if ( token_specific.t_final != NULL) { token_specific.t_final(); }