diff options
author | J.C. Jones <jjones@mozilla.com> | 2019-12-06 15:36:44 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-12-06 15:36:44 +0100 |
commit | 836e72e96caf47add72a13a715722fad030f196c (patch) | |
tree | 7a9a2aeb77ea0e04ac1fc2779dd3cea591a0623e /security/nss/lib/softoken/pkcs11.c | |
parent | d558cf6647406bdbb87c852772ad211670eff223 (diff) | |
download | UXP-836e72e96caf47add72a13a715722fad030f196c.tar UXP-836e72e96caf47add72a13a715722fad030f196c.tar.gz UXP-836e72e96caf47add72a13a715722fad030f196c.tar.lz UXP-836e72e96caf47add72a13a715722fad030f196c.tar.xz UXP-836e72e96caf47add72a13a715722fad030f196c.zip |
[NSS] Bug 1508776 - Remove unneeded refcounting from SFTKSession
SFTKSession objects are only ever actually destroyed at PK11 session
closure, as the session is always the final holder -- and asserting
refCount == 1 shows that to be true. Because of that, NSC_CloseSession
can just call `sftk_DestroySession` directly and leave
`sftk_FreeSession` as a no-op to be removed in the future.
Diffstat (limited to 'security/nss/lib/softoken/pkcs11.c')
-rw-r--r-- | security/nss/lib/softoken/pkcs11.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c index 7dd4f7ee9..7f0adf82f 100644 --- a/security/nss/lib/softoken/pkcs11.c +++ b/security/nss/lib/softoken/pkcs11.c @@ -2674,8 +2674,9 @@ sftk_CloseAllSessions(SFTKSlot *slot, PRBool logout) } else { SKIP_AFTER_FORK(PZ_Unlock(lock)); } - if (session) - sftk_FreeSession(session); + if (session) { + sftk_DestroySession(session); + } } while (session != NULL); } return CKR_OK; @@ -3910,8 +3911,6 @@ NSC_CloseSession(CK_SESSION_HANDLE hSession) if (sftkqueue_is_queued(session, hSession, slot->head, slot->sessHashSize)) { sessionFound = PR_TRUE; sftkqueue_delete(session, hSession, slot->head, slot->sessHashSize); - session->refCount--; /* can't go to zero while we hold the reference */ - PORT_Assert(session->refCount > 0); } PZ_Unlock(lock); @@ -3932,6 +3931,8 @@ NSC_CloseSession(CK_SESSION_HANDLE hSession) if (session->info.flags & CKF_RW_SESSION) { (void)PR_ATOMIC_DECREMENT(&slot->rwSessionCount); } + sftk_DestroySession(session); + session = NULL; } sftk_FreeSession(session); |