diff --git a/mozilla/security/nss/lib/ssl/sslnonce.c b/mozilla/security/nss/lib/ssl/sslnonce.c index 3b8628235ca..80904f413fd 100644 --- a/mozilla/security/nss/lib/ssl/sslnonce.c +++ b/mozilla/security/nss/lib/ssl/sslnonce.c @@ -36,12 +36,13 @@ * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ -/* $Id: sslnonce.c,v 1.17 2005-09-09 03:02:16 nelsonb%netscape.com Exp $ */ +/* $Id: sslnonce.c,v 1.18 2008-02-14 23:58:27 nelson%bolyard.com Exp $ */ #include "nssrenam.h" #include "cert.h" #include "secitem.h" #include "ssl.h" +#include "nss.h" /* for NSS_RegisterShutdown */ #include "sslimpl.h" #include "sslproto.h" @@ -68,10 +69,34 @@ static PZLock * cacheLock = NULL; #define LOCK_CACHE lock_cache() #define UNLOCK_CACHE PZ_Unlock(cacheLock) +static const PRCallOnceType pristineCallOnce; +static PRCallOnceType setupClientCacheLockOnce; + +static SECStatus clientCacheLockShutdown(void* appData, void* nssData) +{ + if (cacheLock) { + PZ_DestroyLock(cacheLock); + cacheLock = NULL; + } + setupClientCacheLockOnce = pristineCallOnce; + return SECSuccess; +} + +static PRStatus clientCacheLockSetup(void) +{ + SECStatus rv = NSS_RegisterShutdown(clientCacheLockShutdown, NULL); + PORT_Assert(SECSuccess == rv); + if (SECSuccess == rv) { + nss_InitLock(&cacheLock, nssILockCache); + return PR_SUCCESS; + } + return PR_FAILURE; +} + void ssl_InitClientSessionCacheLock(void) { if (!cacheLock) - nss_InitLock(&cacheLock, nssILockCache); + PR_CallOnce(&setupClientCacheLockOnce, &clientCacheLockSetup); } static void @@ -359,7 +384,7 @@ ssl_Time(void) { PRUint32 myTime; #if (defined(XP_UNIX) || defined(XP_WIN) || defined(_WINDOWS) || defined(XP_BEOS)) && !defined(_WIN32_WCE) - myTime = time(NULL); /* accurate until the year 2038. */ + myTime = (PRUint32)time(NULL); /* accurate until the year 2038. */ #else /* portable, but possibly slower */ PRTime now; diff --git a/mozilla/security/nss/tests/memleak/ignored b/mozilla/security/nss/tests/memleak/ignored index 5672c55d2e2..fb379098a01 100644 --- a/mozilla/security/nss/tests/memleak/ignored +++ b/mozilla/security/nss/tests/memleak/ignored @@ -26,9 +26,6 @@ #393181 ocspclnt/main/CERT_SetOCSPDefaultResponder/** -#397478 -selfserv/main/SSL_ConfigServerSessionIDCache/** - #397483 **/PR_CallOnce/InitializeArenas/PR_NewLock/**