Fix memory leaks. (roll fixes from 3.7 BRANCH).

This commit is contained in:
relyea%netscape.com 2003-03-05 00:59:36 +00:00
Родитель 426cd10480
Коммит c635402806
3 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -451,6 +451,7 @@ secmod_EncodeData(DBT *data, char * module)
pk11_argSetNewCipherFlags(&ssl[0], ciphers);
SECMOD_PUTLONG(encoded->ssl,ssl[0]);
SECMOD_PUTLONG(&encoded->ssl[4],ssl[1]);
if (ciphers) PORT_Free(ciphers);
offset = (unsigned short) &(((secmodData *)0)->names[0]);
SECMOD_PUTSHORT(encoded->nameStart,offset);
@ -496,6 +497,7 @@ loser:
if (dllName) PORT_Free(dllName);
if (param) PORT_Free(param);
if (slotInfo) PORT_Free(slotInfo);
if (nss) PORT_Free(nss);
return rv;
}

Просмотреть файл

@ -235,7 +235,7 @@ pk11_argParseModuleSpec(char *modulespec, char **lib, char **mod,
int next;
modulespec = pk11_argStrip(modulespec);
*lib = *mod = *parameters = 0;
*lib = *mod = *parameters = *nss = 0;
while (*modulespec) {
PK11_HANDLE_STRING_ARG(modulespec,*lib,PK11_ARG_LIBRARY_PARAMETER,;)

Просмотреть файл

@ -3457,6 +3457,7 @@ CK_RV NSC_Login(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType,
PK11Slot *slot;
PK11Session *session;
NSSLOWKEYDBHandle *handle;
CK_FLAGS sessionFlags;
SECItem *pin;
char pinStr[PK11_MAX_PIN+1];
@ -3466,10 +3467,10 @@ CK_RV NSC_Login(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType,
/* make sure the session is valid */
session = pk11_SessionFromHandle(hSession);
if (session == NULL) {
if (session == NULL) return CKR_SESSION_HANDLE_INVALID;
}
if (session == NULL) return CKR_SESSION_HANDLE_INVALID;
sessionFlags = session->info.flags;
pk11_FreeSession(session);
session = NULL;
/* can't log into the Netscape Slot */
if (slot->slotID == NETSCAPE_SLOT_ID)
@ -3497,7 +3498,7 @@ CK_RV NSC_Login(CK_SESSION_HANDLE hSession, CK_USER_TYPE userType,
if (nsslowkey_HasKeyDBPassword(handle) == SECFailure) {
/* allow SSO's to log in only if there is not password on the
* key database */
if (((userType == CKU_SO) && (session->info.flags & CKF_RW_SESSION))
if (((userType == CKU_SO) && (sessionFlags & CKF_RW_SESSION))
/* fips always needs to authenticate, even if there isn't a db */
|| (slot->slotID == FIPS_SLOT_ID)) {
/* should this be a fixed password? */
@ -3552,9 +3553,9 @@ CK_RV NSC_Logout(CK_SESSION_HANDLE hSession)
SECItem *pw = NULL;
session = pk11_SessionFromHandle(hSession);
if (session == NULL) {
if (session == NULL) return CKR_SESSION_HANDLE_INVALID;
}
if (session == NULL) return CKR_SESSION_HANDLE_INVALID;
pk11_FreeSession(session);
session = NULL;
if (!slot->isLoggedIn) return CKR_USER_NOT_LOGGED_IN;