Bugzilla Bug 286313: code cleanup: use PORT_New and PORT_ZNew to allocate

structures. r=nelsonb.


git-svn-id: svn://10.0.0.236/trunk@170798 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtchang%redhat.com
2005-03-16 21:57:47 +00:00
parent 8961c14722
commit 9f6394e7f4

View File

@@ -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;