Destroy the hash context, public key, private key, and slot so that NSS

shutdown will succeed.  r=relyea.
This commit is contained in:
wtc%netscape.com 2003-04-01 22:47:46 +00:00
Родитель d83f1454df
Коммит 08505503e5
1 изменённых файлов: 15 добавлений и 3 удалений

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

@ -34,7 +34,7 @@
/* /*
* Test program for SDR (Secret Decoder Ring) functions. * 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 #ifdef XP_UNIX
@ -140,7 +140,7 @@ main (int argc, char **argv)
PRBool verbose = PR_FALSE; PRBool verbose = PR_FALSE;
SECKEYPrivateKey *privk = NULL; SECKEYPrivateKey *privk = NULL;
SECKEYPublicKey *pubk = NULL; SECKEYPublicKey *pubk = NULL;
PK11SlotInfo *slot; PK11SlotInfo *slot = NULL;
PRFileDesc *fd; PRFileDesc *fd;
int bytesRead; int bytesRead;
int bytesWritten; int bytesWritten;
@ -148,7 +148,7 @@ main (int argc, char **argv)
unsigned char hash_buf[SHA1_LENGTH]; unsigned char hash_buf[SHA1_LENGTH];
unsigned char sign_buf[40]; /* DSA_LENGTH */ unsigned char sign_buf[40]; /* DSA_LENGTH */
SECItem hash,sign; SECItem hash,sign;
PK11Context *hashcx; PK11Context *hashcx = NULL;
int ks, count=0; int ks, count=0;
int keySize = 1024; int keySize = 1024;
PQGParams *pqgParams = NULL; PQGParams *pqgParams = NULL;
@ -405,6 +405,18 @@ main (int argc, char **argv)
retval = 0; retval = 0;
loser: 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) { if (NSS_Shutdown() != SECSuccess) {
exit(1); exit(1);
} }