[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Mon Feb 22 17:28:46 UTC 2016


The branch master has been updated
       via  a2d0baa2d931feae7f820d4594528894fd4a46cb (commit)
      from  cbb259caaf2cabf9bedc35fd41ba84f048a3de0f (commit)


- Log -----------------------------------------------------------------
commit a2d0baa2d931feae7f820d4594528894fd4a46cb
Author: FdaSilvaYY <fdasilvayy at gmail.com>
Date:   Sun Feb 14 18:44:30 2016 +0100

    GH678: Add a few more zalloc
    
    Remove some duplicated NULL/zero init.
    
    Signed-off-by: Rich Salz <rsalz at openssl.org>
    Reviewed-by: Tim Hudson <tjh at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 crypto/bio/bss_conn.c    | 6 ------
 crypto/bn/bn_recp.c      | 2 +-
 crypto/ec/ecp_nistp256.c | 6 +++---
 crypto/ec/ecp_nistz256.c | 2 --
 crypto/evp/p_lib.c       | 7 +------
 crypto/lock.c            | 2 +-
 6 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c
index 98f4f69..492fe01 100644
--- a/crypto/bio/bss_conn.c
+++ b/crypto/bio/bss_conn.c
@@ -271,12 +271,6 @@ BIO_CONNECT *BIO_CONNECT_new(void)
         return (NULL);
     ret->state = BIO_CONN_S_BEFORE;
     ret->connect_family = BIO_FAMILY_IPANY;
-    ret->param_hostname = NULL;
-    ret->param_service = NULL;
-    ret->info_callback = NULL;
-    ret->connect_mode = 0;
-    ret->addr_first = NULL;
-    ret->addr_iter = NULL;
     return (ret);
 }
 
diff --git a/crypto/bn/bn_recp.c b/crypto/bn/bn_recp.c
index 7824a6d..ef15c8f 100644
--- a/crypto/bn/bn_recp.c
+++ b/crypto/bn/bn_recp.c
@@ -70,7 +70,7 @@ BN_RECP_CTX *BN_RECP_CTX_new(void)
 {
     BN_RECP_CTX *ret;
 
-    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
+    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
         return (NULL);
 
     BN_RECP_CTX_init(ret);
diff --git a/crypto/ec/ecp_nistp256.c b/crypto/ec/ecp_nistp256.c
index d4bff1a..a02af0d 100644
--- a/crypto/ec/ecp_nistp256.c
+++ b/crypto/ec/ecp_nistp256.c
@@ -1816,13 +1816,13 @@ const EC_METHOD *EC_GFp_nistp256_method(void)
 
 static NISTP256_PRE_COMP *nistp256_pre_comp_new()
 {
-    NISTP256_PRE_COMP *ret = NULL;
-    ret = OPENSSL_malloc(sizeof(*ret));
+    NISTP256_PRE_COMP *ret = OPENSSL_zalloc(sizeof(*ret));
+
     if (ret == NULL) {
         ECerr(EC_F_NISTP256_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE);
         return ret;
     }
-    memset(ret->g_pre_comp, 0, sizeof(ret->g_pre_comp));
+
     ret->references = 1;
     return ret;
 }
diff --git a/crypto/ec/ecp_nistz256.c b/crypto/ec/ecp_nistz256.c
index 388e87e..4b95019 100644
--- a/crypto/ec/ecp_nistz256.c
+++ b/crypto/ec/ecp_nistz256.c
@@ -1395,8 +1395,6 @@ static NISTZ256_PRE_COMP *ecp_nistz256_pre_comp_new(const EC_GROUP *group)
 
     ret->group = group;
     ret->w = 6;                 /* default */
-    ret->precomp = NULL;
-    ret->precomp_storage = NULL;
     ret->references = 1;
     return ret;
 }
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 1f9f6f0..221178d 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -186,9 +186,8 @@ int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
 
 EVP_PKEY *EVP_PKEY_new(void)
 {
-    EVP_PKEY *ret;
+    EVP_PKEY *ret = OPENSSL_zalloc(sizeof(*ret));
 
-    ret = OPENSSL_malloc(sizeof(*ret));
     if (ret == NULL) {
         EVPerr(EVP_F_EVP_PKEY_NEW, ERR_R_MALLOC_FAILURE);
         return (NULL);
@@ -196,10 +195,6 @@ EVP_PKEY *EVP_PKEY_new(void)
     ret->type = EVP_PKEY_NONE;
     ret->save_type = EVP_PKEY_NONE;
     ret->references = 1;
-    ret->ameth = NULL;
-    ret->engine = NULL;
-    ret->pkey.ptr = NULL;
-    ret->attributes = NULL;
     ret->save_parameters = 1;
     return (ret);
 }
diff --git a/crypto/lock.c b/crypto/lock.c
index 5a42dc9..aa34202 100644
--- a/crypto/lock.c
+++ b/crypto/lock.c
@@ -249,7 +249,7 @@ int CRYPTO_get_new_dynlockid(void)
     }
     CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
 
-    pointer = OPENSSL_malloc(sizeof(*pointer));
+    pointer = OPENSSL_zalloc(sizeof(*pointer));
     if (pointer == NULL) {
         CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
         return (0);


More information about the openssl-commits mailing list