diff options
author | Rich Salz <rsalz@openssl.org> | 2016-02-08 16:11:56 +0100 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-02-08 17:09:16 +0100 |
commit | 43ecb9c35caed8623cfd83e7d893b8b67725feb7 (patch) | |
tree | 676696126afa484d7afeba51771fdc8d41cc04ab /crypto/evp/evp_lib.c | |
parent | Use File::Path::rmtree rather than File::Path::remove_tree (diff) | |
download | openssl-43ecb9c35caed8623cfd83e7d893b8b67725feb7.tar.xz openssl-43ecb9c35caed8623cfd83e7d893b8b67725feb7.zip |
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>
Diffstat (limited to 'crypto/evp/evp_lib.c')
-rw-r--r-- | crypto/evp/evp_lib.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index ff2a1d253a..a1636284c0 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -352,7 +352,8 @@ unsigned long EVP_MD_flags(const EVP_MD *md) EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type) { - EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD)); + EVP_MD *md = OPENSSL_zalloc(sizeof(*md)); + if (md != NULL) { md->type = md_type; md->pkey_type = pkey_type; @@ -362,7 +363,8 @@ EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type) EVP_MD *EVP_MD_meth_dup(const EVP_MD *md) { EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type); - if (md != NULL) + + if (to != NULL) memcpy(to, md, sizeof(*to)); return to; } |