forked from wolfSSL/wolfssl
coverity: fix double free of encryptedContent.
This commit is contained in:
@ -13698,6 +13698,7 @@ authenv_atrbend:
|
|||||||
/* free memory, zero out keys */
|
/* free memory, zero out keys */
|
||||||
ForceZero(encryptedContent, (word32)encryptedContentSz);
|
ForceZero(encryptedContent, (word32)encryptedContentSz);
|
||||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
||||||
|
encryptedContent = NULL;
|
||||||
ForceZero(decryptedKey, MAX_ENCRYPTED_KEY_SZ);
|
ForceZero(decryptedKey, MAX_ENCRYPTED_KEY_SZ);
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
XFREE(decryptedKey, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
XFREE(decryptedKey, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
||||||
@ -13726,8 +13727,11 @@ authenv_atrbend:
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
ForceZero(encryptedContent, (word32)encryptedContentSz);
|
if (encryptedContent != NULL) {
|
||||||
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
ForceZero(encryptedContent, (word32)encryptedContentSz);
|
||||||
|
XFREE(encryptedContent, pkcs7->heap, DYNAMIC_TYPE_PKCS7);
|
||||||
|
encryptedContent = NULL;
|
||||||
|
}
|
||||||
ForceZero(decryptedKey, MAX_ENCRYPTED_KEY_SZ);
|
ForceZero(decryptedKey, MAX_ENCRYPTED_KEY_SZ);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user