| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 /* | 4 /* |
| 5 * pkix_pl_lifecycle.c | 5 * pkix_pl_lifecycle.c |
| 6 * | 6 * |
| 7 * Lifecycle Functions for the PKIX PL library. | 7 * Lifecycle Functions for the PKIX PL library. |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 return SECSuccess; | 68 return SECSuccess; |
| 69 } | 69 } |
| 70 #endif /* PKIX_OBJECT_LEAK_TEST */ | 70 #endif /* PKIX_OBJECT_LEAK_TEST */ |
| 71 | 71 |
| 72 | 72 |
| 73 PKIX_UInt32 | 73 PKIX_UInt32 |
| 74 pkix_pl_lifecycle_ObjectLeakCheck(int *initObjCountTable) | 74 pkix_pl_lifecycle_ObjectLeakCheck(int *initObjCountTable) |
| 75 { | 75 { |
| 76 int typeCounter = 0; | 76 unsigned int typeCounter = 0; |
| 77 PKIX_UInt32 numObjects = 0; | 77 PKIX_UInt32 numObjects = 0; |
| 78 char classNameBuff[128]; | 78 char classNameBuff[128]; |
| 79 char *className = NULL; | 79 char *className = NULL; |
| 80 | 80 |
| 81 for (; typeCounter < PKIX_NUMTYPES; typeCounter++) { | 81 for (; typeCounter < PKIX_NUMTYPES; typeCounter++) { |
| 82 pkix_ClassTable_Entry *entry = &systemClasses[typeCounter]; | 82 pkix_ClassTable_Entry *entry = &systemClasses[typeCounter]; |
| 83 PKIX_UInt32 objCountDiff = entry->objCounter; | 83 PKIX_UInt32 objCountDiff = entry->objCounter; |
| 84 | 84 |
| 85 if (initObjCountTable) { | 85 if (initObjCountTable) { |
| 86 PKIX_UInt32 initialCount = initObjCountTable[typeCounter]; | 86 PKIX_UInt32 initialCount = initObjCountTable[typeCounter]; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 PKIX_RETURN(OBJECT); | 239 PKIX_RETURN(OBJECT); |
| 240 } | 240 } |
| 241 | 241 |
| 242 /* | 242 /* |
| 243 * PKIX_PL_Shutdown (see comments in pkix_pl_system.h) | 243 * PKIX_PL_Shutdown (see comments in pkix_pl_system.h) |
| 244 */ | 244 */ |
| 245 PKIX_Error * | 245 PKIX_Error * |
| 246 PKIX_PL_Shutdown(void *plContext) | 246 PKIX_PL_Shutdown(void *plContext) |
| 247 { | 247 { |
| 248 #ifdef DEBUG |
| 248 PKIX_UInt32 numLeakedObjects = 0; | 249 PKIX_UInt32 numLeakedObjects = 0; |
| 250 #endif |
| 249 | 251 |
| 250 PKIX_ENTER(OBJECT, "PKIX_PL_Shutdown"); | 252 PKIX_ENTER(OBJECT, "PKIX_PL_Shutdown"); |
| 251 | 253 |
| 252 if (!pkix_pl_initialized) { | 254 if (!pkix_pl_initialized) { |
| 253 /* The library was not initilized */ | 255 /* The library was not initilized */ |
| 254 PKIX_RETURN(OBJECT); | 256 PKIX_RETURN(OBJECT); |
| 255 } | 257 } |
| 256 | 258 |
| 257 PR_DestroyLock(classTableLock); | 259 PR_DestroyLock(classTableLock); |
| 258 | 260 |
| 259 pkix_pl_HttpCertStore_Shutdown(plContext); | 261 pkix_pl_HttpCertStore_Shutdown(plContext); |
| 260 | 262 |
| 263 #ifdef DEBUG |
| 261 numLeakedObjects = pkix_pl_lifecycle_ObjectLeakCheck(NULL); | 264 numLeakedObjects = pkix_pl_lifecycle_ObjectLeakCheck(NULL); |
| 262 if (PR_GetEnv("NSS_STRICT_SHUTDOWN")) { | 265 if (PR_GetEnv("NSS_STRICT_SHUTDOWN")) { |
| 263 PORT_Assert(numLeakedObjects == 0); | 266 PORT_Assert(numLeakedObjects == 0); |
| 264 } | 267 } |
| 268 #else |
| 269 pkix_pl_lifecycle_ObjectLeakCheck(NULL); |
| 270 #endif |
| 265 | 271 |
| 266 if (plContext != NULL) { | 272 if (plContext != NULL) { |
| 267 PKIX_PL_NssContext_Destroy(plContext); | 273 PKIX_PL_NssContext_Destroy(plContext); |
| 268 } | 274 } |
| 269 | 275 |
| 270 pkix_pl_initialized = PKIX_FALSE; | 276 pkix_pl_initialized = PKIX_FALSE; |
| 271 | 277 |
| 272 PKIX_RETURN(OBJECT); | 278 PKIX_RETURN(OBJECT); |
| 273 } | 279 } |
| OLD | NEW |