Skip to content

Commit 592a356

Browse files
committed
Use sizeof(var) rather than sizeof(type) where appropriate
1 parent 5c9dc05 commit 592a356

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/wp_digests.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static CTX* name##_newctx(WOLFPROV_CTX* provCtx) \
6262
CTX* ctx = NULL; \
6363
(void)provCtx; \
6464
if (wolfssl_prov_is_running()) { \
65-
ctx = OPENSSL_zalloc(sizeof(CTX)); \
65+
ctx = OPENSSL_zalloc(sizeof(*ctx)); \
6666
} \
6767
return ctx; \
6868
}

src/wp_drbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ static int wp_drbg_instantiate(wp_DrbgCtx* ctx, unsigned int strength,
190190

191191
if (ok) {
192192
/* Initialize wolfCrypt RNG with parent-provided seed */
193-
ctx->rng = OPENSSL_zalloc(sizeof(WC_RNG));
193+
ctx->rng = OPENSSL_zalloc(sizeof(*ctx->rng));
194194
if (ctx->rng == NULL) {
195195
ok = 0;
196196
}

src/wp_internal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ int wp_encrypt_key(WOLFPROV_CTX* provCtx, const char* cipherName,
925925
ok = 0;
926926
}
927927
if (ok) {
928-
XMEMSET(info, 0, sizeof(EncryptedInfo));
928+
XMEMSET(info, 0, sizeof(info));
929929
XSTRNCPY(info->name, cipherName, NAME_SZ-1);
930930
info->name[NAME_SZ-1] = '\0';
931931

src/wp_wolfprov.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static WOLFPROV_CTX* wolfssl_prov_ctx_new(void)
217217

218218
WP_CHECK_FIPS_ALGO_PTR(WP_CAST_ALGO_DRBG);
219219

220-
ctx = (WOLFPROV_CTX*)OPENSSL_zalloc(sizeof(WOLFPROV_CTX));
220+
ctx = (WOLFPROV_CTX*)OPENSSL_zalloc(sizeof(*ctx));
221221
if ((ctx != NULL) && (wc_InitRng(&ctx->rng) != 0)) {
222222
OPENSSL_free(ctx);
223223
ctx = NULL;

0 commit comments

Comments
 (0)