From 92c55833edbe394dd0b5cfb8317b929763b40ae4 Mon Sep 17 00:00:00 2001 From: "alexei.volkov.bugs%sun.com" Date: Fri, 24 Oct 2008 19:44:06 +0000 Subject: [PATCH] 459359 - ForwardBuilderState object is leaked when AIA path incorrect. r=nelson git-svn-id: svn://10.0.0.236/trunk@254751 18797224-902f-48f8-a5cc-f745e15eee43 --- .../nss/lib/libpkix/pkix/top/pkix_build.c | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/mozilla/security/nss/lib/libpkix/pkix/top/pkix_build.c b/mozilla/security/nss/lib/libpkix/pkix/top/pkix_build.c index be6535ef722..d6aed03c9ba 100755 --- a/mozilla/security/nss/lib/libpkix/pkix/top/pkix_build.c +++ b/mozilla/security/nss/lib/libpkix/pkix/top/pkix_build.c @@ -2510,22 +2510,50 @@ pkix_BuildForwardDepthFirstSearch( if (state->status == BUILD_AIAPENDING && state->buildConstants.aiaMgr) { - PKIX_CHECK(PKIX_PL_AIAMgr_GetAIACerts + pkixErrorResult = PKIX_PL_AIAMgr_GetAIACerts (state->buildConstants.aiaMgr, state->prevCert, &nbio, &unfilteredCerts, - plContext), - PKIX_AIAMGRGETAIACERTSFAILED); + plContext); if (nbio != NULL) { /* IO still pending, resume later */ *pNBIOContext = nbio; goto cleanup; } - state->numCerts = 0; - + if (pkixErrorResult) { + pkixErrorClass = pkixErrorResult->errClass; + if (pkixErrorClass == PKIX_FATAL_ERROR) { + goto fatal; + } + PKIX_DECREF(finalError); + finalError = pkixErrorResult; + pkixErrorResult = NULL; + if (state->verifyNode != NULL) { + /* state->verifyNode is the object that contains a list + * of verifyNodes. verifyNodes contains cert chain build + * failures that occured on this level of chian building. + * Here, creating new verify node + * to log the failure and adding it to the list. */ + PKIX_CHECK_FATAL(pkix_VerifyNode_Create + (state->prevCert, + 0, NULL, + &verifyNode, + plContext), + PKIX_VERIFYNODECREATEFAILED); + PKIX_CHECK_FATAL(pkix_VerifyNode_SetError + (verifyNode, finalError, plContext), + PKIX_VERIFYNODESETERRORFAILED); + PKIX_CHECK_FATAL(pkix_VerifyNode_AddToTree + (state->verifyNode, + verifyNode, + plContext), + PKIX_VERIFYNODEADDTOTREEFAILED); + PKIX_DECREF(verifyNode); + } + } #ifdef PKIX_BUILDDEBUG /* Turn this on to trace the List of Certs, before CertSelect */ {