Fix for bug 270689 . minor issues remaining with list cleanup and on-the-fly lock creation
authorjulien.pierre.bugs%sun.com
Tue, 08 Mar 2005 05:52:33 +0000
changeset 5518 ea6bdd7f41d7952300f5d9f1df0d7153a5b4dc6d
parent 5517 8f67b8db11cddd81d5ca83592f5ed577c568f64b
child 5520 42a05da37c69f0594a7a3d79bed6d23d37398003
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
@@ -2125,19 +2125,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) {
@@ -2174,19 +2171,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);
 	}