if (to) { nssCryptokiObject_Destroy(to); }
nssTrustDomain_FindTrustForCertificate(  NSSTrustDomain *td,  NSSCertificate *c){    PRStatus status;    NSSSlot **slots;    NSSSlot **slotp;    NSSToken *token;    nssCryptokiObject *to = NULL;    nssPKIObject *pkio = NULL;    NSSTrust *rvt = NULL;    nssUpdateLevel updateLevel;    slots = nssTrustDomain_GetActiveSlots(td, &updateLevel);    if (!slots) {	return (NSSTrust *)NULL;    }    for (slotp = slots; *slotp; slotp++) {	token = nssSlot_GetToken(*slotp);	if (token) {	    to = nssToken_FindTrustForCertificate(token, NULL, 	                                          &c->encoding,	                                          &c->issuer,	                                          &c->serial,	                                      nssTokenSearchType_TokenOnly);	    if (to) {		if (!pkio) {		    pkio = nssPKIObject_Create(NULL, to, td, NULL);		    if (!pkio) {			goto loser;		    }		} else {		    status = nssPKIObject_AddInstance(pkio, to);		    if (status != PR_SUCCESS) {			goto loser;		    }		}	    }	    nssToken_Destroy(token);	}    }    if (pkio) {	rvt = nssTrust_Create(pkio, &c->encoding);	if (!rvt) {	    goto loser;	}    }    nssSlotArray_Destroy(slots);    return rvt;loser:    nssSlotArray_Destroy(slots);    if (to) {	nssCryptokiObject_Destroy(to);    }    if (pkio) {	nssPKIObject_Destroy(pkio);    }    return (NSSTrust *)NULL;}