From 64b25758edca688a30f02c260262150f7ad0bc7d Mon Sep 17 00:00:00 2001 From: Rich Salz Date: Thu, 3 Sep 2015 09:15:26 -0400 Subject: remove 0 assignments. After openssl_zalloc, cleanup more "set to 0/NULL" assignments. Many are from github feedback. Reviewed-by: Tim Hudson --- crypto/engine/eng_dyn.c | 13 +++---------- crypto/engine/eng_openssl.c | 7 ++----- 2 files changed, 5 insertions(+), 15 deletions(-) (limited to 'crypto/engine') diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c index 777f44018b..100b050b9d 100644 --- a/crypto/engine/eng_dyn.c +++ b/crypto/engine/eng_dyn.c @@ -208,22 +208,15 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE); return 0; } - c->dynamic_dso = NULL; - c->v_check = NULL; - c->bind_engine = NULL; - c->DYNAMIC_LIBNAME = NULL; - c->no_vcheck = 0; - c->engine_id = NULL; - c->list_add_value = 0; - c->DYNAMIC_F1 = "v_check"; - c->DYNAMIC_F2 = "bind_engine"; - c->dir_load = 1; c->dirs = sk_OPENSSL_STRING_new_null(); if (!c->dirs) { ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX, ERR_R_MALLOC_FAILURE); OPENSSL_free(c); return 0; } + c->DYNAMIC_F1 = "v_check"; + c->DYNAMIC_F2 = "bind_engine"; + c->dir_load = 1; CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); if ((*ctx = (dynamic_data_ctx *)ENGINE_get_ex_data(e, dynamic_ex_data_idx)) diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c index eaf06180c9..4bc9b2ec69 100644 --- a/crypto/engine/eng_openssl.c +++ b/crypto/engine/eng_openssl.c @@ -425,13 +425,10 @@ typedef struct { static int ossl_hmac_init(EVP_PKEY_CTX *ctx) { OSSL_HMAC_PKEY_CTX *hctx; - hctx = OPENSSL_malloc(sizeof(*hctx)); + + hctx = OPENSSL_zalloc(sizeof(*hctx)); if (!hctx) return 0; - hctx->md = NULL; - hctx->ktmp.data = NULL; - hctx->ktmp.length = 0; - hctx->ktmp.flags = 0; hctx->ktmp.type = V_ASN1_OCTET_STRING; HMAC_CTX_init(&hctx->ctx); EVP_PKEY_CTX_set_data(ctx, hctx); -- cgit v1.2.3