slot->slotID = slotID;
PK11Slot * pk11_NewSlotFromID(CK_SLOT_ID slotID, int moduleIndex){    PK11Slot *slot = NULL;    PLHashEntry *entry;    int index;    index = pk11_GetModuleIndex(slotID);    /* make sure the slotID for this module is valid */    if (moduleIndex != index) {	return NULL;    }    if (nscSlotList[index] == NULL) {	nscSlotListSize[index] = NSC_SLOT_LIST_BLOCK_SIZE;	nscSlotList[index] = (CK_SLOT_ID *)		PORT_ZAlloc(nscSlotListSize[index]*sizeof(CK_SLOT_ID));	if (nscSlotList[index] == NULL) {	    return NULL;	}    }    if (nscSlotCount[index] >= nscSlotListSize[index]) {	CK_SLOT_ID* oldNscSlotList = nscSlotList[index];	CK_ULONG oldNscSlotListSize = nscSlotListSize[index];	nscSlotListSize[index] += NSC_SLOT_LIST_BLOCK_SIZE;	nscSlotList[index] = (CK_SLOT_ID *) PORT_Realloc(oldNscSlotList,				nscSlotListSize[index]*sizeof(CK_SLOT_ID));	if (nscSlotList[index] == NULL) {            nscSlotList[index] = oldNscSlotList;            nscSlotListSize[index] = oldNscSlotListSize;            return NULL;	}    }    if (nscSlotHashTable[index] == NULL) {	nscSlotHashTable[index] = PL_NewHashTable(64,pk11_HashNumber,				PL_CompareValues, PL_CompareValues, NULL, 0);	if (nscSlotHashTable[index] == NULL) {	    return NULL;	}    }    slot = (PK11Slot *) PORT_ZAlloc(sizeof(PK11Slot));    if (slot == NULL) {	return NULL;    }    entry = PL_HashTableAdd(nscSlotHashTable[index],(void *)slotID,slot);    if (entry == NULL) {	PORT_Free(slot);	return NULL;    }    slot->index = (nscSlotCount[index] & 0x7f) | ((index << 7) & 0x80);    nscSlotList[index][nscSlotCount[index]++] = slotID;    return slot;}