Fix for bug 270689 . minor issues remaining with list cleanup and on-the-fly lock creation NSS_3_9_BRANCH
authorjulien.pierre.bugs%sun.com
Tue, 08 Mar 2005 05:55:29 +0000
branchNSS_3_9_BRANCH
changeset 5519 e12d9cd94f5ae7906b86f003b24e1254e4396cd3
parent 5516 bfe9e9ddcbd942ac0d04dab291aed2072c910f76
child 5528 00ccd4a8f77905b6df6fadeab6436d25f0f7b407
push idunknown
push userunknown
push dateunknown
bugs270689
Fix for bug 270689 . minor issues remaining with list cleanup and on-the-fly lock creation
security/nss/lib/softoken/pkcs11u.c
--- a/security/nss/lib/softoken/pkcs11u.c
+++ b/security/nss/lib/softoken/pkcs11u.c
@@ -2118,19 +2118,16 @@ pk11_PutObjectToList(PK11Object *object,
 
     /* the code below is equivalent to :
      *     optimizeSpace = isSessionObject ? object->optimizeSpace : PR_FALSE;
      * just faster.
      */
     PRBool optimizeSpace = isSessionObject && 
 				((PK11SessionObject *)object)->optimizeSpace; 
     if (!optimizeSpace && (list->count < MAX_OBJECT_LIST_SIZE)) {
-	if (list->lock == NULL) {
-	    list->lock = PZ_NewLock(nssILockObject);
-	}
 	PK11_USE_THREADS(PZ_Lock(list->lock));
 	object->next = list->head;
 	list->head = object;
 	list->count++;
 	PK11_USE_THREADS(PZ_Unlock(list->lock));
 	return;
     }
     if (isSessionObject) {
@@ -2167,19 +2164,21 @@ void pk11_InitFreeLists(void)
     pk11_InitFreeList(&tokenObjectList);
 }
    
 static void
 pk11_CleanupFreeList(PK11ObjectFreeList *list, PRBool isSessionList)
 {
     PK11Object *object;
 
+#ifdef PKCS11_USE_THREADS
     if (!list->lock) {
 	return;
     }
+#endif
     PK11_USE_THREADS(PZ_Lock(list->lock));
     for (object= list->head; object != NULL; 
 					object = pk11_freeObjectData(object)) {
 #ifdef PKCS11_USE_THREADS
 	PZ_DestroyLock(object->refLock);
 	if (isSessionList) {
 	    PZ_DestroyLock(((PK11SessionObject *)object)->attributeLock);
 	}