diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2021-12-03 17:07:54 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2021-12-03 17:07:54 +0000 |
commit | 83b1b2b09fa519fdbe0da16d661ef07f26a80413 (patch) | |
tree | 5d5d09f1e6c42ffbe485492d4ca3e53ddc3b8208 | |
parent | 96e715635b7bf041af4f14093e0cd07fa1eb90cc (diff) |
Use calloc() for X509_CRL_METHOD_new() instead of malloc().
This ensures that if any members are added to this struct, they will be
initialised.
ok schwarze@ tb@
-rw-r--r-- | lib/libcrypto/asn1/x_crl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libcrypto/asn1/x_crl.c b/lib/libcrypto/asn1/x_crl.c index bfc01a22848..8cea9e0b7b5 100644 --- a/lib/libcrypto/asn1/x_crl.c +++ b/lib/libcrypto/asn1/x_crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_crl.c,v 1.35 2021/11/01 20:53:08 tb Exp $ */ +/* $OpenBSD: x_crl.c,v 1.36 2021/12/03 17:07:53 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -660,14 +660,15 @@ X509_CRL_METHOD_new(int (*crl_init)(X509_CRL *crl), { X509_CRL_METHOD *m; - m = malloc(sizeof(X509_CRL_METHOD)); - if (!m) + if ((m = calloc(1, sizeof(X509_CRL_METHOD))) == NULL) return NULL; + m->crl_init = crl_init; m->crl_free = crl_free; m->crl_lookup = crl_lookup; m->crl_verify = crl_verify; m->flags = X509_CRL_METHOD_DYNAMIC; + return m; } |