summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-03-11 16:02:06 +0000
committertb <>2023-03-11 16:02:06 +0000
commitf8e764961049d6799cdf3040a39bba824db929cf (patch)
tree4ee5bd0a9443d54f82302b874ea09239411e2d12 /src/lib
parent1cb4662fa3084e47b21509a54a711ecef28ab3a1 (diff)
downloadopenbsd-f8e764961049d6799cdf3040a39bba824db929cf.tar.gz
openbsd-f8e764961049d6799cdf3040a39bba824db929cf.tar.bz2
openbsd-f8e764961049d6799cdf3040a39bba824db929cf.zip
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 'src/lib')
-rw-r--r--src/lib/libcrypto/asn1/bio_ndef.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c
index 33dfe73fc9..3fd7f3c4c3 100644
--- a/src/lib/libcrypto/asn1/bio_ndef.c
+++ b/src/lib/libcrypto/asn1/bio_ndef.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bio_ndef.c,v 1.14 2023/03/11 15:56:03 tb Exp $ */ 1/* $OpenBSD: bio_ndef.c,v 1.15 2023/03/11 16:02:06 tb 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. 3 * project.
4 */ 4 */
@@ -109,10 +109,11 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it)
109 ASN1error(ASN1_R_STREAMING_NOT_SUPPORTED); 109 ASN1error(ASN1_R_STREAMING_NOT_SUPPORTED);
110 return NULL; 110 return NULL;
111 } 111 }
112 ndef_aux = malloc(sizeof(NDEF_SUPPORT));
113 asn_bio = BIO_new(BIO_f_asn1());
114 112
115 if (ndef_aux == NULL || asn_bio == NULL) 113 if ((ndef_aux = calloc(1, sizeof(NDEF_SUPPORT))) == NULL)
114 goto err;
115
116 if ((asn_bio = BIO_new(BIO_f_asn1())) == NULL)
116 goto err; 117 goto err;
117 118
118 if ((out = BIO_push(asn_bio, out)) == NULL) 119 if ((out = BIO_push(asn_bio, out)) == NULL)