Add and use OPENSSL_zalloc

There are many places (nearly 50) where we malloc and then memset.
Add an OPENSSL_zalloc routine to encapsulate that.
(Missed one conversion; thanks Richard)
Also fixes GH328

Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
Rich Salz
2015-08-25 13:25:58 -04:00
committed by Rich Salz
parent 66e87a9f09
commit b51bce9420
45 changed files with 82 additions and 168 deletions

View File

@@ -198,15 +198,12 @@ EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags)
{
EVP_PKEY_METHOD *pmeth;
pmeth = OPENSSL_malloc(sizeof(*pmeth));
pmeth = OPENSSL_zalloc(sizeof(*pmeth));
if (!pmeth)
return NULL;
memset(pmeth, 0, sizeof(*pmeth));
pmeth->pkey_id = id;
pmeth->flags = flags | EVP_PKEY_FLAG_DYNAMIC;
pmeth->init = 0;
pmeth->copy = 0;
pmeth->cleanup = 0;