From 3792f3db2ca80bf0bc10829616593a7afe146613 Mon Sep 17 00:00:00 2001 From: "wtchang%redhat.com" Date: Wed, 16 Mar 2005 21:57:47 +0000 Subject: Bugzilla Bug 286313: code cleanup: use PORT_New and PORT_ZNew to allocate structures. r=nelsonb. --- security/nss/lib/pk11wrap/pk11skey.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'security/nss') diff --git a/security/nss/lib/pk11wrap/pk11skey.c b/security/nss/lib/pk11wrap/pk11skey.c index c34ed29ba..169efeae8 100644 --- a/security/nss/lib/pk11wrap/pk11skey.c +++ b/security/nss/lib/pk11wrap/pk11skey.c @@ -88,7 +88,7 @@ pk11_getKeyFromList(PK11SlotInfo *slot) { return symKey; } - symKey = (PK11SymKey *)PORT_Alloc(sizeof(PK11SymKey)); + symKey = PORT_New(PK11SymKey); if (symKey == NULL) { return NULL; } @@ -1450,8 +1450,7 @@ PK11_PubDerive(SECKEYPrivateKey *privKey, SECKEYPublicKey *pubKey, symKey->size = keySize; if (key_size == 0) templateCount--; - mechParams = (CK_ECDH1_DERIVE_PARAMS *) - PORT_ZAlloc(sizeof(CK_ECDH1_DERIVE_PARAMS)); + mechParams = PORT_ZNew(CK_ECDH1_DERIVE_PARAMS); mechParams->kdf = CKD_SHA1_KDF; mechParams->ulSharedDataLen = 0; mechParams->pSharedData = NULL; @@ -1547,8 +1546,7 @@ PK11_PubDeriveWithKDF(SECKEYPrivateKey *privKey, SECKEYPublicKey *pubKey, symKey->size = keySize; if (key_size == 0) templateCount--; - mechParams = (CK_ECDH1_DERIVE_PARAMS *) - PORT_ZAlloc(sizeof(CK_ECDH1_DERIVE_PARAMS)); + mechParams = PORT_ZNew(CK_ECDH1_DERIVE_PARAMS); if ((kdf < CKD_NULL) || (kdf > CKD_SHA1_KDF)) { PORT_SetError(SEC_ERROR_INVALID_ALGORITHM); break; -- cgit v1.2.1