[Bug 334183] Double free on error because CERT_FindCertIssuer unexpectedly calls CERT_DestroyCertificate. r=alexei

This commit is contained in:
alexei.volkov.bugs%sun.com 2006-04-22 02:09:09 +00:00
Родитель 1d134e6b56
Коммит fc87dbb2fe
1 изменённых файлов: 9 добавлений и 9 удалений

Просмотреть файл

@ -360,20 +360,20 @@ loser:
chain, 2, NULL, &status, td, cc);
nss_ZFreeIf(nssTime);
if (status == PR_SUCCESS) {
PORT_Assert(me == chain[0]);
/* if it's a root, the chain will only have one cert */
if (!chain[1]) {
/* already has a reference from the call to BuildChain */
return cert;
} else {
CERT_DestroyCertificate(cert); /* the first cert in the chain */
return STAN_GetCERTCertificate(chain[1]); /* return the 2nd */
}
} else {
if (chain[0]) {
CERT_DestroyCertificate(cert);
}
PORT_SetError (SEC_ERROR_UNKNOWN_ISSUER);
}
NSSCertificate_Destroy(chain[0]); /* the first cert in the chain */
return STAN_GetCERTCertificate(chain[1]); /* return the 2nd */
}
if (chain[0]) {
PORT_Assert(me == chain[0]);
NSSCertificate_Destroy(chain[0]); /* the first cert in the chain */
}
PORT_SetError (SEC_ERROR_UNKNOWN_ISSUER);
return NULL;
#endif
}