summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2021-12-03 17:10:49 +0000
committerjsing <>2021-12-03 17:10:49 +0000
commit71a63cb5a08d9412085831434e6af134e801b560 (patch)
treeeee7b4de2572551240e0875a0b720a92274a168d /src
parente94cd16b1f5f7d4c936a98943e606b77a5f906f5 (diff)
downloadopenbsd-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@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/tasn_prn.c16
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 = {
84ASN1_PCTX * 84ASN1_PCTX *
85ASN1_PCTX_new(void) 85ASN1_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
101void 97void