summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%netscape.com <devnull@localhost>2003-04-01 22:47:46 +0000
committerwtc%netscape.com <devnull@localhost>2003-04-01 22:47:46 +0000
commit11e334273ba4f9b5535561bdd3038cf43678fc35 (patch)
tree2ba5288b6ec26d80ae367265cfdbb77d58819819
parent59f9c65685a7cb44b68720650cbe17424da7609a (diff)
downloadnss-hg-11e334273ba4f9b5535561bdd3038cf43678fc35.tar.gz
Destroy the hash context, public key, private key, and slot so that NSS
shutdown will succeed. r=relyea.
-rw-r--r--security/nss/cmd/shlibsign/shlibsign.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/security/nss/cmd/shlibsign/shlibsign.c b/security/nss/cmd/shlibsign/shlibsign.c
index 727af31e3..6d4af89b4 100644
--- a/security/nss/cmd/shlibsign/shlibsign.c
+++ b/security/nss/cmd/shlibsign/shlibsign.c
@@ -140,7 +140,7 @@ main (int argc, char **argv)
PRBool verbose = PR_FALSE;
SECKEYPrivateKey *privk = NULL;
SECKEYPublicKey *pubk = NULL;
- PK11SlotInfo *slot;
+ PK11SlotInfo *slot = NULL;
PRFileDesc *fd;
int bytesRead;
int bytesWritten;
@@ -148,7 +148,7 @@ main (int argc, char **argv)
unsigned char hash_buf[SHA1_LENGTH];
unsigned char sign_buf[40]; /* DSA_LENGTH */
SECItem hash,sign;
- PK11Context *hashcx;
+ PK11Context *hashcx = NULL;
int ks, count=0;
int keySize = 1024;
PQGParams *pqgParams = NULL;
@@ -405,6 +405,18 @@ main (int argc, char **argv)
retval = 0;
loser:
+ if (hashcx) {
+ PK11_DestroyContext(hashcx, PR_TRUE);
+ }
+ if (privk) {
+ SECKEY_DestroyPrivateKey(privk);
+ }
+ if (pubk) {
+ SECKEY_DestroyPublicKey(pubk);
+ }
+ if (slot) {
+ PK11_FreeSlot(slot);
+ }
if (NSS_Shutdown() != SECSuccess) {
exit(1);
}