Bug 202593: Create slot->freeListLock and slot->sessionLock in the order

consistent with the cleanup code on error return.
This commit is contained in:
wtc%netscape.com 2003-05-13 23:00:28 +00:00
parent 2caff01bdb
commit 63123ca797

View File

@ -406,19 +406,20 @@ PK11_NewSlotInfo(SECMODModule *mod)
if (slot == NULL) return slot;
#ifdef PKCS11_USE_THREADS
slot->freeListLock = PZ_NewLock(nssILockFreelist);
if (slot->freeListLock == NULL) {
PZ_DestroyLock(slot->sessionLock);
PORT_Free(slot);
return slot;
}
slot->sessionLock = mod->isThreadSafe ?
PZ_NewLock(nssILockSession) : (PZLock *)mod->refLock;
if (slot->sessionLock == NULL) {
PORT_Free(slot);
return slot;
}
slot->freeListLock = PZ_NewLock(nssILockFreelist);
if (slot->freeListLock == NULL) {
if (mod->isThreadSafe) {
PZ_DestroyLock(slot->sessionLock);
}
PORT_Free(slot);
return slot;
}
#else
slot->sessionLock = NULL;
slot->freeListLock = NULL;