CERTCertificate *cert = STAN_GetCERTCertificate(ct); if (!cert) { return NULL; } CERT_DestroyCertificate(cert);
CERT_DestroyCertificate(STAN_GetCERTCertificateOrRelease(ct));
CERT_FindCertByName(CERTCertDBHandle *handle, SECItem *name){    NSSCertificate *cp, *ct, *c;    NSSDER subject;    NSSUsage usage;    NSSCryptoContext *cc;    NSSITEM_FROM_SECITEM(&subject, name);    usage.anyUsage = PR_TRUE;    cc = STAN_GetDefaultCryptoContext();    ct = NSSCryptoContext_FindBestCertificateBySubject(cc, &subject,                                                        NULL, &usage, NULL);    cp = NSSTrustDomain_FindBestCertificateBySubject(handle, &subject,                                                      NULL, &usage, NULL);    c = get_best_temp_or_perm(ct, cp);    if (ct) {	CERTCertificate *cert = STAN_GetCERTCertificate(ct);        if (!cert) {            return NULL;        }	CERT_DestroyCertificate(cert);    }    if (cp) {	CERTCertificate *cert = STAN_GetCERTCertificate(cp);        if (!cert) {            return NULL;        }	CERT_DestroyCertificate(cert);    }    if (c) {	return STAN_GetCERTCertificate(c);    } else {	return NULL;    }}