Again fix memory leaks, but also fix the latent bug in pcertdb shutdown
leak plugging exposed. bob r=glen git-svn-id: svn://10.0.0.236/trunk@228135 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -36,7 +36,7 @@
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* $Id: lginit.c,v 1.5 2007-06-15 03:51:08 rrelyea%redhat.com Exp $ */
|
||||
/* $Id: lginit.c,v 1.6 2007-06-15 20:37:56 rrelyea%redhat.com Exp $ */
|
||||
|
||||
#include "lowkeyi.h"
|
||||
#include "pcert.h"
|
||||
@@ -460,6 +460,7 @@ CK_RV
|
||||
lg_Close(SDB *sdb)
|
||||
{
|
||||
LGPrivate *lgdb_p = (LGPrivate *)sdb->private;
|
||||
lg_ClearTokenKeyHashTable(sdb);
|
||||
if (lgdb_p) {
|
||||
if (lgdb_p->certDB) {
|
||||
nsslowcert_ClosePermCertDB(lgdb_p->certDB);
|
||||
|
||||
@@ -296,13 +296,13 @@ lg_freeHashItem(PLHashEntry* entry, PRIntn index, void *arg)
|
||||
}
|
||||
|
||||
CK_RV
|
||||
LG_ClearTokenKeyHashTable(SDB *sdb)
|
||||
lg_ClearTokenKeyHashTable(SDB *sdb)
|
||||
{
|
||||
PLHashTable *hashTable;
|
||||
lg_DBLock(sdb);
|
||||
hashTable= lg_GetHashTable(sdb);
|
||||
PL_HashTableEnumerateEntries(hashTable, lg_freeHashItem, NULL);
|
||||
lg_DBLock(sdb);
|
||||
lg_DBUnlock(sdb);
|
||||
return CKR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
/*
|
||||
* Permanent Certificate database handling code
|
||||
*
|
||||
* $Id: pcertdb.c,v 1.4 2007-06-15 03:51:08 rrelyea%redhat.com Exp $
|
||||
* $Id: pcertdb.c,v 1.5 2007-06-15 20:37:56 rrelyea%redhat.com Exp $
|
||||
*/
|
||||
#include "lowkeyti.h"
|
||||
#include "pcert.h"
|
||||
@@ -4462,6 +4462,7 @@ nsslowcert_ClosePermCertDB(NSSLOWCERTCertDBHandle *handle)
|
||||
PZ_DestroyMonitor(handle->dbMon);
|
||||
handle->dbMon = NULL;
|
||||
}
|
||||
PORT_Free(handle);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -5263,6 +5264,9 @@ nsslowcert_SaveSMimeProfile(NSSLOWCERTCertDBHandle *dbhandle, char *emailAddr,
|
||||
void
|
||||
nsslowcert_DestroyFreeLists(void)
|
||||
{
|
||||
if (freeListLock == NULL) {
|
||||
return;
|
||||
}
|
||||
DestroyCertEntryFreeList();
|
||||
DestroyTrustFreeList();
|
||||
DestroyCertFreeList();
|
||||
|
||||
@@ -172,9 +172,12 @@ sftkdb_LoadLibrary(const char *libname)
|
||||
PORT_Free(trueParentLibPath);
|
||||
}
|
||||
#endif
|
||||
PORT_Free(parentLibPath);
|
||||
|
||||
done:
|
||||
if (parentLibPath) {
|
||||
PORT_Free(parentLibPath);
|
||||
}
|
||||
|
||||
/* still couldn't load it, try the generic path */
|
||||
if (!lib) {
|
||||
PRLibSpec libSpec;
|
||||
@@ -322,7 +325,7 @@ CK_RV
|
||||
sftkdbCall_Shutdown(void)
|
||||
{
|
||||
CK_RV crv = CKR_OK;
|
||||
if (legacy_glue_lib) {
|
||||
if (!legacy_glue_lib) {
|
||||
return CKR_OK;
|
||||
}
|
||||
if (legacy_glue_shutdown) {
|
||||
|
||||
@@ -557,7 +557,6 @@ sftkdb_GetAttributeValue(SFTKDBHandle *handle, CK_OBJECT_HANDLE object_id,
|
||||
CK_ATTRIBUTE *ntemplate;
|
||||
unsigned char *data = NULL;
|
||||
SDB *db;
|
||||
int i;
|
||||
|
||||
if (handle == NULL) {
|
||||
return CKR_GENERAL_ERROR;
|
||||
@@ -697,6 +696,9 @@ sftkdb_CloseDB(SFTKDBHandle *handle)
|
||||
if (handle->db) {
|
||||
(*handle->db->sdb_Close)(handle->db);
|
||||
}
|
||||
if (handle->passwordLock) {
|
||||
PZ_DestroyLock(handle->passwordLock);
|
||||
}
|
||||
PORT_Free(handle);
|
||||
return CKR_OK;
|
||||
}
|
||||
|
||||
@@ -590,8 +590,9 @@ sftk_getSecmodName(char *param, SDBType *dbType, char **appName,
|
||||
}
|
||||
|
||||
*rw = PR_TRUE;
|
||||
if (sftk_argHasFlag("flags","readOnly",save_params) ||
|
||||
sftk_argHasFlag("flags","noModDB",save_params)) *rw = PR_FALSE;
|
||||
if (sftk_argHasFlag("flags","readOnly",save_params)) {
|
||||
*rw = PR_FALSE;
|
||||
}
|
||||
|
||||
if (!secmodName || *secmodName == '\0') {
|
||||
if (secmodName) PORT_Free(secmodName);
|
||||
@@ -601,6 +602,12 @@ sftk_getSecmodName(char *param, SDBType *dbType, char **appName,
|
||||
*filename = secmodName;
|
||||
lconfigdir = sftk_EvaluateConfigDir(configdir, dbType, appName);
|
||||
|
||||
if (sftk_argHasFlag("flags","noModDB",save_params)) {
|
||||
/* there isn't a module db, don't load the legacy support */
|
||||
*dbType = SDB_SQL;
|
||||
*rw = PR_FALSE;
|
||||
}
|
||||
|
||||
/* only use the renamed secmod for legacy databases */
|
||||
if ((*dbType != SDB_LEGACY) && (*dbType != SDB_MULTIACCESS)) {
|
||||
secmodName="pkcs11.txt";
|
||||
|
||||
Reference in New Issue
Block a user