summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaie%kuix.de <devnull@localhost>2007-10-04 13:04:44 +0000
committerkaie%kuix.de <devnull@localhost>2007-10-04 13:04:44 +0000
commit4c8fa13e9ded2d954d7dadc29894ce7aeae31865 (patch)
tree361a9779120a05f32ebf7b6aaaf269e664f461af
parente2964e599fb1fa3280c516c13c6242c793ac5fa7 (diff)
downloadnss-hg-4c8fa13e9ded2d954d7dadc29894ce7aeae31865.tar.gz
Bug 391770, OCSP_Global.monitor is leaked on shutdown
Leak found by David Baron r=kengert, r=nelson
-rw-r--r--security/nss/lib/certhigh/ocsp.c14
-rw-r--r--security/nss/lib/certhigh/ocspi.h2
-rw-r--r--security/nss/lib/nss/nssinit.c2
-rw-r--r--security/nss/tests/memleak/ignored4
4 files changed, 15 insertions, 7 deletions
diff --git a/security/nss/lib/certhigh/ocsp.c b/security/nss/lib/certhigh/ocsp.c
index 189e9a73c..c6c487a6e 100644
--- a/security/nss/lib/certhigh/ocsp.c
+++ b/security/nss/lib/certhigh/ocsp.c
@@ -874,7 +874,7 @@ SECStatus OCSP_InitGlobal(void)
return rv;
}
-SECStatus OCSP_ShutdownCache(void)
+SECStatus OCSP_ShutdownGlobal(void)
{
if (!OCSP_Global.monitor)
return SECSuccess;
@@ -888,7 +888,19 @@ SECStatus OCSP_ShutdownCache(void)
PORT_Assert(OCSP_Global.cache.numberOfEntries == 0);
OCSP_Global.cache.MRUitem = NULL;
OCSP_Global.cache.LRUitem = NULL;
+
+ OCSP_Global.defaultHttpClientFcn = NULL;
+ OCSP_Global.maxCacheEntries = DEFAULT_OCSP_CACHE_SIZE;
+ OCSP_Global.minimumSecondsToNextFetchAttempt =
+ DEFAULT_MINIMUM_SECONDS_TO_NEXT_OCSP_FETCH_ATTEMPT;
+ OCSP_Global.maximumSecondsToNextFetchAttempt =
+ DEFAULT_MAXIMUM_SECONDS_TO_NEXT_OCSP_FETCH_ATTEMPT;
+ OCSP_Global.ocspFailureMode =
+ ocspMode_FailureIsVerificationFailure;
PR_ExitMonitor(OCSP_Global.monitor);
+
+ PR_DestroyMonitor(OCSP_Global.monitor);
+ OCSP_Global.monitor = NULL;
return SECSuccess;
}
diff --git a/security/nss/lib/certhigh/ocspi.h b/security/nss/lib/certhigh/ocspi.h
index 279988d80..539365d0c 100644
--- a/security/nss/lib/certhigh/ocspi.h
+++ b/security/nss/lib/certhigh/ocspi.h
@@ -43,6 +43,6 @@
#define _OCSPI_H_
SECStatus OCSP_InitGlobal(void);
-SECStatus OCSP_ShutdownCache(void);
+SECStatus OCSP_ShutdownGlobal(void);
#endif /* _OCSPI_H_ */
diff --git a/security/nss/lib/nss/nssinit.c b/security/nss/lib/nss/nssinit.c
index a686f7ec6..2b99e9294 100644
--- a/security/nss/lib/nss/nssinit.c
+++ b/security/nss/lib/nss/nssinit.c
@@ -810,7 +810,7 @@ NSS_Shutdown(void)
shutdownRV = SECFailure;
}
ShutdownCRLCache();
- OCSP_ShutdownCache();
+ OCSP_ShutdownGlobal();
/* ifdef PKIX_Shutdown until bug 391815(undetected leaks by NSS leak testing)
* is fixed */
diff --git a/security/nss/tests/memleak/ignored b/security/nss/tests/memleak/ignored
index 294818693..1389a0c91 100644
--- a/security/nss/tests/memleak/ignored
+++ b/security/nss/tests/memleak/ignored
@@ -100,10 +100,6 @@ ocspclnt/main/NSS_Init/SECMOD_LoadModule/SECMOD_LoadModule/SECMOD_LoadPKCS11Modu
*/main/NSS_Shutdown/STAN_Shutdown/NSSTrustDomain_Destroy/nssList_Clear/token_destructor/nssToken_Destroy/nssArena_Destroy/arena_remove_pointer/nssPointerTracker_remove/PL_HashTableRemove/PL_HashTableRawRemove/DefaultAllocTable/**
*/main/*/*/STAN_LoadDefaultNSS3TrustDomain/NSSTrustDomain_Create/NSSArena_Create/nssArena_Create/arena_add_pointer/nssPointerTracker_initialize/call_once/**
-#391770
-*/main/*/*/OCSP_InitGlobal/PR_NewMonitor/**
-ocspclnt/main/NSS_Init/OCSP_InitGlobal/PR_NewMonitor/*
-
#391774
*/main/*/*/PKIX_Initialize/PKIX_PL_HashTable_Create/PKIX_PL_Mutex_Create/PKIX_PL_Object_Alloc/PKIX_PL_Malloc/**
*/main/*/*/PKIX_Initialize/PKIX_PL_HashTable_Create/PKIX_PL_Mutex_Create/PKIX_PL_Object_Alloc/PR_NewLock/**