From 93b9d9fe97c1ae06e498d7e945c2821ad497a669 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Thu, 9 May 2002 23:01:21 +0000 Subject: [PATCH] Bugzilla bug 135826: fixed the slot reference leaks. --- security/nss/cmd/crmftest/testcrmf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/security/nss/cmd/crmftest/testcrmf.c b/security/nss/cmd/crmftest/testcrmf.c index db9add0bc51..42e02a38cce 100644 --- a/security/nss/cmd/crmftest/testcrmf.c +++ b/security/nss/cmd/crmftest/testcrmf.c @@ -177,23 +177,28 @@ GetSubjectPubKeyInfo(SECKEYPrivateKey **destPrivKey, SECKEYPrivateKey *privKey = NULL; SECKEYPublicKey *pubKey = NULL; PK11SlotInfo *keySlot = NULL; + PK11SlotInfo *cryptoSlot = NULL; PK11RSAGenParams *rsaParams = NULL; PQGParams *dsaParams = NULL; keySlot = PK11_GetInternalKeySlot(); PK11_Authenticate(keySlot, PR_FALSE, NULL); - PK11_Authenticate(PK11_GetInternalSlot(), PR_FALSE, NULL); + cryptoSlot = PK11_GetInternalSlot(); + PK11_Authenticate(cryptoSlot, PR_FALSE, NULL); + PK11_FreeSlot(cryptoSlot); rsaParams = GetRSAParams(); privKey = PK11_GenerateKeyPair(keySlot, CKM_RSA_PKCS_KEY_PAIR_GEN, (void*)rsaParams, &pubKey, PR_FALSE, PR_FALSE, NULL); /* dsaParams = GetDSAParams(); if (dsaParams == NULL) { + PK11_FreeSlot(keySlot); return NULL; } privKey = PK11_GenerateKeyPair(keySlot, CKM_DSA_KEY_PAIR_GEN, (void*)dsaParams, &pubKey, PR_FALSE, PR_FALSE, NULL);*/ + PK11_FreeSlot(keySlot); if (privKey == NULL || pubKey == NULL) { if (pubKey) { SECKEY_DestroyPublicKey(pubKey);