GH641: Don't care openssl_zmalloc
Don't cast malloc-family return values.
Also found some places where (a) blank line was missing; and (b)
the *wrong* return value was checked.
Reviewed-by: Richard Levitte <levitte@openssl.org>
diff --git a/crypto/evp/cmeth_lib.c b/crypto/evp/cmeth_lib.c
index 1e7cac8..33944e1 100644
--- a/crypto/evp/cmeth_lib.c
+++ b/crypto/evp/cmeth_lib.c
@@ -64,7 +64,8 @@
EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len)
{
- EVP_CIPHER *cipher = (EVP_CIPHER *)OPENSSL_zalloc(sizeof(EVP_CIPHER));
+ EVP_CIPHER *cipher = OPENSSL_zalloc(sizeof(EVP_CIPHER));
+
if (cipher != NULL) {
cipher->nid = cipher_type;
cipher->block_size = block_size;
@@ -77,7 +78,8 @@
{
EVP_CIPHER *to = EVP_CIPHER_meth_new(cipher->nid, cipher->block_size,
cipher->key_len);
- if (cipher != NULL)
+
+ if (to != NULL)
memcpy(to, cipher, sizeof(*to));
return to;
}