summaryrefslogtreecommitdiff
path: root/usr/src/lib/pkcs11/pkcs11_softtoken/common
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/lib/pkcs11/pkcs11_softtoken/common')
-rw-r--r--usr/src/lib/pkcs11/pkcs11_softtoken/common/softSessionUtil.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSessionUtil.c b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSessionUtil.c
index 4c0859f41e..70693b36e1 100644
--- a/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSessionUtil.c
+++ b/usr/src/lib/pkcs11/pkcs11_softtoken/common/softSessionUtil.c
@@ -334,16 +334,20 @@ soft_delete_session(soft_session_t *session_p,
session_p->ses_close_sync &= ~SESSION_REFCNT_WAITING;
- /* Mark session as no longer valid. */
- session_p->magic_marker = 0;
-
- (void) pthread_cond_destroy(&session_p->ses_free_cond);
-
/*
* Remove all the objects created in this session.
*/
soft_delete_all_objects_in_session(session_p);
+ /*
+ * Mark session as no longer valid. This can only be done after all
+ * objects created by this session are free'd since the marker is
+ * still needed in the process of removing objects from the session.
+ */
+ session_p->magic_marker = 0;
+
+ (void) pthread_cond_destroy(&session_p->ses_free_cond);
+
/* In case application did not call Final */
if (session_p->digest.context != NULL)
free(session_p->digest.context);