PK11GenericObject *lastObj, *obj;
PK11GenericObject *lastObj = NULL, *obj;
PK11_FindGenericObjects(PK11SlotInfo *slot, CK_OBJECT_CLASS objClass){    CK_ATTRIBUTE template[1];    CK_ATTRIBUTE *attrs = template;    CK_OBJECT_HANDLE *objectIDs = NULL;    PK11GenericObject *lastObj, *obj;    PK11GenericObject *firstObj = NULL;    int i, count = 0;    PK11_SETATTRS(attrs, CKA_CLASS, &objClass, sizeof(objClass)); attrs++;    objectIDs = pk11_FindObjectsByTemplate(slot,template,1,&count);    if (objectIDs == NULL) {	return NULL;    }    /* where we connect our object once we've created it.. */    for (i=0; i < count; i++) {	obj = PORT_New(PK11GenericObject);	if ( !obj ) {	    PK11_DestroyGenericObjects(firstObj);	    PORT_Free(objectIDs);	    return NULL;	}	/* initialize it */		obj->slot = PK11_ReferenceSlot(slot);	obj->objectID = objectIDs[i];	obj->next = NULL;	obj->prev = NULL;	/* link it in */	if (firstObj == NULL) {	    firstObj = obj;	} else {	    PK11_LinkGenericObject(lastObj, obj);	}	lastObj = obj;    }    PORT_Free(objectIDs);    return firstObj;}