X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=crypto%2Fevp%2Fevp_lib.c;h=a1636284c05de8d066f875898774ca03ed4b4c84;hb=43ecb9c35caed8623cfd83e7d893b8b67725feb7;hp=ff2a1d253adffd6783c350a08e85aaa53ed6bab2;hpb=4500a4cd4d89ba338ad796d39ccb9d94794cc0d7;p=openssl.git 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; }