diff options
author | Jenine <jenine_c@outlook.com> | 2019-09-16 08:39:04 +0000 |
---|---|---|
committer | Jenine <jenine_c@outlook.com> | 2019-09-16 08:39:04 +0000 |
commit | 998e3b95e0cdc9d63adfb5b4e86ae7a98b19781b (patch) | |
tree | b11a608f50419f9c26ca16bcfed59bdffa43aa84 | |
parent | cbef3a5c7f3a8172e26fd97c174bfa18e542196e (diff) | |
download | nss-hg-998e3b95e0cdc9d63adfb5b4e86ae7a98b19781b.tar.gz |
Bug 1558313 - Fix clang warnings in pk11importtest.c and pkcs11.c r=marcusburghardt
Differential Revision: https://phabricator.services.mozilla.com/D41486
-rw-r--r-- | cmd/pk11importtest/pk11importtest.c | 4 | ||||
-rw-r--r-- | lib/softoken/pkcs11.c | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/cmd/pk11importtest/pk11importtest.c b/cmd/pk11importtest/pk11importtest.c index eb8e359ba..e8326594a 100644 --- a/cmd/pk11importtest/pk11importtest.c +++ b/cmd/pk11importtest/pk11importtest.c @@ -176,7 +176,9 @@ cleanup: } SECITEM_FreeItem(&pubValue, PR_FALSE); SECITEM_FreeItem(&privID, PR_FALSE); - PORT_FreeArena(epki->arena, PR_TRUE); + if (epki && epki->arena) { + PORT_FreeArena(epki->arena, PR_TRUE); + } SECKEY_DestroyPublicKey(pubKey); SECKEY_DestroyPrivateKey(privKey); fprintf(stderr, "%s PrivateKeyImport %s ***********************\n", diff --git a/lib/softoken/pkcs11.c b/lib/softoken/pkcs11.c index b713254b1..7a5996f06 100644 --- a/lib/softoken/pkcs11.c +++ b/lib/softoken/pkcs11.c @@ -2285,14 +2285,19 @@ sftk_PutPubKey(SFTKObject *publicKey, SFTKObject *privateKey, CK_KEY_TYPE keyTyp default: return CKR_KEY_TYPE_INCONSISTENT; } + if (crv != CKR_OK) { + return crv; + } crv = sftk_AddAttributeType(publicKey, CKA_CLASS, &classType, sizeof(CK_OBJECT_CLASS)); - if (crv != CKR_OK) + if (crv != CKR_OK) { return crv; + } crv = sftk_AddAttributeType(publicKey, CKA_KEY_TYPE, &keyType, sizeof(CK_KEY_TYPE)); - if (crv != CKR_OK) + if (crv != CKR_OK) { return crv; + } /* now handle the operator attributes */ if (sftk_isTrue(privateKey, CKA_DECRYPT)) { crv = sftk_forceAttribute(publicKey, CKA_ENCRYPT, &cktrue, sizeof(CK_BBOOL)); |