From 08505503e56f2cb793303a9958815738522d7777 Mon Sep 17 00:00:00 2001 From: "wtc%netscape.com" Date: Tue, 1 Apr 2003 22:47:46 +0000 Subject: [PATCH] Destroy the hash context, public key, private key, and slot so that NSS shutdown will succeed. r=relyea. --- security/nss/cmd/shlibsign/shlibsign.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/security/nss/cmd/shlibsign/shlibsign.c b/security/nss/cmd/shlibsign/shlibsign.c index 25241c42a4a..296c1097a45 100644 --- a/security/nss/cmd/shlibsign/shlibsign.c +++ b/security/nss/cmd/shlibsign/shlibsign.c @@ -34,7 +34,7 @@ /* * Test program for SDR (Secret Decoder Ring) functions. * - * $Id: shlibsign.c,v 1.10 2003-04-01 19:09:41 bishakhabanerjee%netscape.com Exp $ + * $Id: shlibsign.c,v 1.11 2003-04-01 22:47:46 wtc%netscape.com Exp $ */ #ifdef XP_UNIX @@ -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); }