diff options
author | jsing <> | 2021-12-03 17:10:49 +0000 |
---|---|---|
committer | jsing <> | 2021-12-03 17:10:49 +0000 |
commit | 71a63cb5a08d9412085831434e6af134e801b560 (patch) | |
tree | eee7b4de2572551240e0875a0b720a92274a168d | |
parent | e94cd16b1f5f7d4c936a98943e606b77a5f906f5 (diff) | |
download | openbsd-71a63cb5a08d9412085831434e6af134e801b560.tar.gz openbsd-71a63cb5a08d9412085831434e6af134e801b560.tar.bz2 openbsd-71a63cb5a08d9412085831434e6af134e801b560.zip |
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-- | src/lib/libcrypto/asn1/tasn_prn.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_prn.c b/src/lib/libcrypto/asn1/tasn_prn.c index 4c676d8c04..54ec56ec25 100644 --- a/src/lib/libcrypto/asn1/tasn_prn.c +++ b/src/lib/libcrypto/asn1/tasn_prn.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: tasn_prn.c,v 1.21 2020/03/24 10:46:38 inoguchi Exp $ */ | 1 | /* $OpenBSD: tasn_prn.c,v 1.22 2021/12/03 17:10:49 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -84,18 +84,14 @@ ASN1_PCTX default_pctx = { | |||
84 | ASN1_PCTX * | 84 | ASN1_PCTX * |
85 | ASN1_PCTX_new(void) | 85 | ASN1_PCTX_new(void) |
86 | { | 86 | { |
87 | ASN1_PCTX *ret; | 87 | ASN1_PCTX *p; |
88 | ret = malloc(sizeof(ASN1_PCTX)); | 88 | |
89 | if (ret == NULL) { | 89 | if ((p = calloc(1, sizeof(ASN1_PCTX))) == NULL) { |
90 | ASN1error(ERR_R_MALLOC_FAILURE); | 90 | ASN1error(ERR_R_MALLOC_FAILURE); |
91 | return NULL; | 91 | return NULL; |
92 | } | 92 | } |
93 | ret->flags = 0; | 93 | |
94 | ret->nm_flags = 0; | 94 | return p; |
95 | ret->cert_flags = 0; | ||
96 | ret->oid_flags = 0; | ||
97 | ret->str_flags = 0; | ||
98 | return ret; | ||
99 | } | 95 | } |
100 | 96 | ||
101 | void | 97 | void |