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

@@ -3836,9 +3836,8 @@ int ssl3_new(SSL *s)
{
SSL3_STATE *s3;
if ((s3 = OPENSSL_malloc(sizeof(*s3))) == NULL)
if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL)
goto err;
memset(s3, 0, sizeof(*s3));
s->s3 = s3;
#ifndef OPENSSL_NO_SRP