diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2021-12-03 17:10:50 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2021-12-03 17:10:50 +0000 |
commit | 0285b2528a887ede4d0d8e002d48e65c1ad4a315 (patch) | |
tree | e86ff05ebc4773e3e6776b903539b3fc7c257677 | |
parent | 83b1b2b09fa519fdbe0da16d661ef07f26a80413 (diff) |
Convert ASN1_PCTX_new() to calloc().
Rather than using malloc() and then initialising all struct members to zero
values, use calloc().
ok schwarze@ tb@
-rw-r--r-- | lib/libcrypto/asn1/tasn_prn.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/libcrypto/asn1/tasn_prn.c b/lib/libcrypto/asn1/tasn_prn.c index 4c676d8c04f..54ec56ec25e 100644 --- a/lib/libcrypto/asn1/tasn_prn.c +++ b/lib/libcrypto/asn1/tasn_prn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tasn_prn.c,v 1.21 2020/03/24 10:46:38 inoguchi Exp $ */ +/* $OpenBSD: tasn_prn.c,v 1.22 2021/12/03 17:10:49 jsing Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -84,18 +84,14 @@ ASN1_PCTX default_pctx = { ASN1_PCTX * ASN1_PCTX_new(void) { - ASN1_PCTX *ret; - ret = malloc(sizeof(ASN1_PCTX)); - if (ret == NULL) { + ASN1_PCTX *p; + + if ((p = calloc(1, sizeof(ASN1_PCTX))) == NULL) { ASN1error(ERR_R_MALLOC_FAILURE); return NULL; } - ret->flags = 0; - ret->nm_flags = 0; - ret->cert_flags = 0; - ret->oid_flags = 0; - ret->str_flags = 0; - return ret; + + return p; } void |