diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2023-03-11 16:02:07 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2023-03-11 16:02:07 +0000 |
commit | be549033a3f1c17681697db415bfd4d5596db6dd (patch) | |
tree | f55d8280ee8a62770ad0c743900d11ae8970399d /lib | |
parent | 50fe360007514d85c0280d8415c98c4a8fed3e63 (diff) |
Tiny cleanup for readability
Turn a malloc() into calloc() and check two function calls directly
forever instead of a combined check afterward.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/asn1/bio_ndef.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libcrypto/asn1/bio_ndef.c b/lib/libcrypto/asn1/bio_ndef.c index 33dfe73fc95..3fd7f3c4c36 100644 --- a/lib/libcrypto/asn1/bio_ndef.c +++ b/lib/libcrypto/asn1/bio_ndef.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bio_ndef.c,v 1.14 2023/03/11 15:56:03 tb Exp $ */ +/* $OpenBSD: bio_ndef.c,v 1.15 2023/03/11 16:02:06 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ @@ -109,10 +109,11 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) ASN1error(ASN1_R_STREAMING_NOT_SUPPORTED); return NULL; } - ndef_aux = malloc(sizeof(NDEF_SUPPORT)); - asn_bio = BIO_new(BIO_f_asn1()); - if (ndef_aux == NULL || asn_bio == NULL) + if ((ndef_aux = calloc(1, sizeof(NDEF_SUPPORT))) == NULL) + goto err; + + if ((asn_bio = BIO_new(BIO_f_asn1())) == NULL) goto err; if ((out = BIO_push(asn_bio, out)) == NULL) |