summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexei.volkov.bugs%sun.com <devnull@localhost>2008-03-31 21:07:25 +0000
committeralexei.volkov.bugs%sun.com <devnull@localhost>2008-03-31 21:07:25 +0000
commit686ae859a1b6074a6e9176689005899442a0c3a9 (patch)
tree3faebc3340bb1033cfe153d4a2e1c3b3053d8bd2
parent02c63185fc4143860459fc958b0aaad4fa05ec0d (diff)
downloadnss-hg-686ae859a1b6074a6e9176689005899442a0c3a9.tar.gz
425516 - need to destroy data pointed by CERTValOutParam array in case of error. r=nelson
-rw-r--r--security/nss/lib/certhigh/certvfypkix.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/security/nss/lib/certhigh/certvfypkix.c b/security/nss/lib/certhigh/certvfypkix.c
index dfca700b2..afcd1e139 100644
--- a/security/nss/lib/certhigh/certvfypkix.c
+++ b/security/nss/lib/certhigh/certvfypkix.c
@@ -1772,6 +1772,31 @@ cert_pkixSetParam(PKIX_ProcessingParams *procParams,
}
+void
+cert_pkixDestroyValOutParam(CERTValOutParam *params)
+{
+ CERTValOutParam *i;
+
+ if (params == NULL) {
+ return;
+ }
+ for (i = params; i->type != cert_po_end; i++) {
+ switch (i->type) {
+ case cert_po_trustAnchor:
+ if (i->value.pointer.cert) {
+ CERT_DestroyCertificate(i->value.pointer.cert);
+ i->value.pointer.cert = NULL;
+ }
+ break;
+
+ case cert_po_certList:
+ if (i->value.pointer.chain) {
+ CERT_DestroyCertList(i->value.pointer.chain);
+ i->value.pointer.chain = NULL;
+ }
+ }
+ }
+}
static PRUint64 certRev_NSS_3_11_Ocsp_Enabled_Soft_Policy_LeafFlags[2] = {
/* crl */
@@ -2198,9 +2223,9 @@ cleanup:
SECErrorCodes nssErrorCode = 0;
cert_PkixErrorToNssCode(error, &nssErrorCode, plContext);
+ cert_pkixDestroyValOutParam(paramsOut);
PORT_SetError(nssErrorCode);
PKIX_PL_Object_DecRef((PKIX_PL_Object *)error, plContext);
- /* XXX Destroy output params in case of error. See bug 425516. */
}
PKIX_PL_NssContext_Destroy(plContext);