Bug 1280844 - Remove even more redundant null checks in lib/. r?mt.
MozReview-Commit-ID: tDsUZbXn2j
--- a/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.c
+++ b/security/nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_aiamgr.c
@@ -361,17 +361,17 @@ pkix_pl_AIAMgr_GetHTTPCerts(
} else {
PKIX_ERROR(PKIX_UNSUPPORTEDVERSIONOFHTTPCLIENT);
}
cleanup:
/* Session and request cleanup in case of error. Passing through without cleanup
* if interrupted by blocked IO. */
- if (PKIX_ERROR_RECEIVED && aiaMgr) {
+ if (PKIX_ERROR_RECEIVED) {
if (aiaMgr->client.hdata.requestSession != NULL) {
(*hcv1->freeFcn)(aiaMgr->client.hdata.requestSession);
aiaMgr->client.hdata.requestSession = NULL;
}
if (aiaMgr->client.hdata.serverSession != NULL) {
(*hcv1->freeSessionFcn)(aiaMgr->client.hdata.serverSession);
aiaMgr->client.hdata.serverSession = NULL;
}
--- a/security/nss/lib/pk11wrap/pk11akey.c
+++ b/security/nss/lib/pk11wrap/pk11akey.c
@@ -808,20 +808,19 @@ PK11_GetPrivateModulusLen(SECKEYPrivateK
if (crv != CKR_OK) {
PORT_SetError( PK11_MapError(crv) );
return -1;
}
length = theTemplate.ulValueLen;
if ( *(unsigned char *)theTemplate.pValue == 0) {
length--;
}
- if (theTemplate.pValue != NULL)
- PORT_Free(theTemplate.pValue);
+ PORT_Free(theTemplate.pValue);
return (int) length;
-
+
case fortezzaKey:
case dsaKey:
case dhKey:
default:
break;
}
if (theTemplate.pValue != NULL)
PORT_Free(theTemplate.pValue);
--- a/security/nss/lib/pk11wrap/pk11obj.c
+++ b/security/nss/lib/pk11wrap/pk11obj.c
@@ -1239,20 +1239,18 @@ PK11_UnwrapPrivKey(PK11SlotInfo *slot, P
PK11_ExitSlotMonitor(slot);
}
PK11_FreeSymKey(newKey);
newKey = NULL;
} else {
crv = CKR_FUNCTION_NOT_SUPPORTED;
}
- if (ck_id) {
- SECITEM_FreeItem(ck_id, PR_TRUE);
- ck_id = NULL;
- }
+ SECITEM_FreeItem(ck_id, PR_TRUE);
+ ck_id = NULL;
if (crv != CKR_OK) {
/* we couldn't unwrap the key, use the internal module to do the
* unwrap, then load the new key into the token */
PK11SlotInfo *int_slot = PK11_GetInternalSlot();
if (int_slot && (slot != int_slot)) {
SECKEYPrivateKey *privKey = PK11_UnwrapPrivKey(int_slot,
--- a/security/nss/lib/pk11wrap/pk11skey.c
+++ b/security/nss/lib/pk11wrap/pk11skey.c
@@ -1770,18 +1770,17 @@ static PK11SymKey *pk11_ANSIX963Derive(P
}
PORT_ZFree(buffer, bufferLen);
if (newSharedSecret != NULL)
PK11_FreeSymKey(newSharedSecret);
return intermediateResult;
loser:
- if (buffer != NULL)
- PORT_ZFree(buffer, bufferLen);
+ PORT_ZFree(buffer, bufferLen);
if (newSharedSecret != NULL)
PK11_FreeSymKey(newSharedSecret);
if (intermediateResult != NULL)
PK11_FreeSymKey(intermediateResult);
return NULL;
}
/*
--- a/security/nss/lib/pk11wrap/pk11slot.c
+++ b/security/nss/lib/pk11wrap/pk11slot.c
@@ -555,20 +555,18 @@ PK11_FindSlotsByNames(const char *dllNam
rv = SECFailure;
break;
}
if ((PR_FALSE == presentOnly || PK11_IsPresent(tmpSlot)) &&
( (!tokenName) ||
(0==PORT_Strcmp(tmpSlot->token_name, tokenName)) ) &&
( (!slotName) ||
(0==PORT_Strcmp(tmpSlot->slot_name, slotName)) ) ) {
- if (tmpSlot) {
- PK11_AddSlotToList(slotList, tmpSlot, PR_TRUE);
- slotcount++;
- }
+ PK11_AddSlotToList(slotList, tmpSlot, PR_TRUE);
+ slotcount++;
}
}
}
}
SECMOD_ReleaseReadLock(moduleLock);
if ( (0 == slotcount) || (SECFailure == rv) ) {
PORT_SetError(SEC_ERROR_NO_TOKEN);