summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornelsonb%netscape.com <devnull@localhost>2001-04-06 17:47:15 +0000
committernelsonb%netscape.com <devnull@localhost>2001-04-06 17:47:15 +0000
commit7cbaf8f1f0b4b8bcf782c16cf13e36a07319b231 (patch)
treee81dd550ecc121d6cc21c16f8ef1991212146642
parent1c6232168e5b504ea6d9f0593c6d232856e5e266 (diff)
downloadnss-hg-7cbaf8f1f0b4b8bcf782c16cf13e36a07319b231.tar.gz
Merge changes from NSS_3_2_BRANCH. Fix backward compatibility issues.
-rw-r--r--security/nss/lib/util/secport.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/security/nss/lib/util/secport.c b/security/nss/lib/util/secport.c
index b6269967b..6f9c510c9 100644
--- a/security/nss/lib/util/secport.c
+++ b/security/nss/lib/util/secport.c
@@ -49,6 +49,7 @@
#include "prmon.h"
#include "nsslocks.h"
#include "secport.h"
+#include "prvrsion.h"
#ifdef DEBUG
#define THREADMARK
@@ -74,7 +75,8 @@ typedef struct threadmark_mark_str {
#endif /* THREADMARK */
-#define ARENAPOOL_MAGIC 0xB8AC9BDD
+/* The value of this magic must change each time PORTArenaPool changes. */
+#define ARENAPOOL_MAGIC 0xB8AC9BDF
typedef struct PORTArenaPool_str {
PLArenaPool arena;
@@ -187,8 +189,6 @@ PORT_GetError(void)
/********************* Arena code follows *****************************/
-PZMonitor * arenaMonitor;
-
PLArenaPool *
PORT_NewArena(unsigned long chunksize)
{
@@ -262,13 +262,29 @@ PORT_FreeArena(PLArenaPool *arena, PRBool zero)
{
PORTArenaPool *pool = (PORTArenaPool *)arena;
PRLock * lock = (PRLock *)0;
+ size_t len = sizeof *arena;
+ extern const PRVersionDescription * libVersionPoint(void);
+ static const PRVersionDescription * pvd;
+ static PRBool doFreeArenaPool;
if (ARENAPOOL_MAGIC == pool->magic ) {
+ len = sizeof *pool;
lock = pool->lock;
PZ_Lock(lock);
}
+ if (!pvd) {
+ /* no need for thread protection here */
+ pvd = libVersionPoint();
+ if ((pvd->vMajor > 4) ||
+ (pvd->vMajor == 4 && pvd->vMinor > 1) ||
+ (pvd->vMajor == 4 && pvd->vMinor == 1 && pvd->vPatch >= 1)) {
+ doFreeArenaPool = PR_TRUE;
+ }
+ }
+ if (doFreeArenaPool)
+ PL_FreeArenaPool(arena);
PL_FinishArenaPool(arena);
- PORT_ZFree(pool, sizeof(*pool));
+ PORT_ZFree(arena, len);
if (lock) {
PZ_Unlock(lock);
PZ_DestroyLock(lock);