diff --git a/security/nss/lib/pk11wrap/pk11skey.c b/security/nss/lib/pk11wrap/pk11skey.c index 729cbc3ad9d..8152957f3a2 100644 --- a/security/nss/lib/pk11wrap/pk11skey.c +++ b/security/nss/lib/pk11wrap/pk11skey.c @@ -2945,7 +2945,7 @@ PK11_VerifyRecover(SECKEYPublicKey *key, SECStatus PK11_Verify(SECKEYPublicKey *key, SECItem *sig, SECItem *hash, void *wincx) { - PK11SlotInfo *slot = PK11_ReferenceSlot(key->pkcs11Slot); + PK11SlotInfo *slot = key->pkcs11Slot; CK_OBJECT_HANDLE id = key->pkcs11ID; CK_MECHANISM mech = {0, NULL, 0 }; PRBool owner = PR_TRUE; @@ -2963,6 +2963,8 @@ PK11_Verify(SECKEYPublicKey *key, SECItem *sig, SECItem *hash, void *wincx) } id = PK11_ImportPublicKey(slot,key,PR_FALSE); + } else { + PK11_ReferenceSlot(slot); } session = pk11_GetNewSession(slot,&owner);