tmpnickname = STAN_GetCERTCertificateName(c); if (tmpnickname) { nickname = PORT_ArenaStrdup(certList->arena, tmpnickname); PORT_Assert(nickname); PORT_Free(tmpnickname); }
nickname = STAN_GetCERTCertificateName(certList->arena, c);
pk11ListCertCallback(NSSCertificate *c, void *arg){    struct listCertsStr *listCertP = (struct listCertsStr *)arg;    CERTCertificate *newCert = NULL;    PK11CertListType type = listCertP->type;    CERTCertList *certList = listCertP->certList;    PRBool isUnique = PR_FALSE;    PRBool isCA = PR_FALSE;    char *nickname = NULL;    char *tmpnickname = NULL;    unsigned int certType;    if ((type == PK11CertListUnique) || (type == PK11CertListRootUnique)) {	isUnique = PR_TRUE;    }    if ((type == PK11CertListCA) || (type == PK11CertListRootUnique)) {	isCA = PR_TRUE;    }    /* if we want user certs and we don't have one skip this cert */    if ((type == PK11CertListUser) && 		!NSSCertificate_IsPrivateKeyAvailable(c, NULL,NULL)) {	return PR_SUCCESS;    }    /* if we want root certs, skip the user certs */    if ((type == PK11CertListRootUnique) && 		NSSCertificate_IsPrivateKeyAvailable(c, NULL,NULL)) {	return PR_SUCCESS;    }    /* if we want Unique certs and we already have it on our list, skip it */    if ( isUnique && isOnList(certList,c) ) {	return PR_SUCCESS;    }    newCert = STAN_GetCERTCertificate(c);    if (!newCert) {	return PR_SUCCESS;    }    /* if we want CA certs and it ain't one, skip it */    if( isCA  && (!CERT_IsCACert(newCert, &certType)) ) {	return PR_SUCCESS;    }    if (isUnique) {	CERT_DupCertificate(newCert);        tmpnickname = STAN_GetCERTCertificateName(c);        if (tmpnickname) {            nickname = PORT_ArenaStrdup(certList->arena, tmpnickname);            PORT_Assert(nickname);            PORT_Free(tmpnickname);        }	/* put slot certs at the end */	if (newCert->slot && !PK11_IsInternal(newCert->slot)) {	    CERT_AddCertToListTailWithData(certList,newCert,nickname);	} else {	    CERT_AddCertToListHeadWithData(certList,newCert,nickname);	}    } else {	/* add multiple instances to the cert list */	nssCryptokiObject **ip;	nssCryptokiObject **instances = nssPKIObject_GetInstances(&c->object);	if (!instances) {	    return PR_SUCCESS;	}	for (ip = instances; *ip; ip++) {	    nssCryptokiObject *instance = *ip;	    PK11SlotInfo *slot = instance->token->pk11slot;	    /* put the same CERTCertificate in the list for all instances */	    CERT_DupCertificate(newCert);            tmpnickname = STAN_GetCERTCertificateNameForInstance(c, instance);            if (tmpnickname) {                nickname = PORT_ArenaStrdup(certList->arena, tmpnickname);                PORT_Assert(nickname);                PORT_Free(tmpnickname);            }	    /* put slot certs at the end */	    if (slot && !PK11_IsInternal(slot)) {		CERT_AddCertToListTailWithData(certList,newCert,nickname);	    } else {		CERT_AddCertToListHeadWithData(certList,newCert,nickname);	    }	}	nssCryptokiObjectArray_Destroy(instances);    }    return PR_SUCCESS;}