diff options
author | jsing <> | 2024-02-17 14:29:07 +0000 |
---|---|---|
committer | jsing <> | 2024-02-17 14:29:07 +0000 |
commit | 8b5c8b457a257ae2930ac247453e99a1dee9a693 (patch) | |
tree | 4ba5138fd22dd99b30516f01fd4c7506e046ec30 /src/lib | |
parent | 0455d44ca862d8513a8f65a1149a6e59c10bba5c (diff) | |
download | openbsd-8b5c8b457a257ae2930ac247453e99a1dee9a693.tar.gz openbsd-8b5c8b457a257ae2930ac247453e99a1dee9a693.tar.bz2 openbsd-8b5c8b457a257ae2930ac247453e99a1dee9a693.zip |
Use calloc() instead of malloc() in BIO_new().
ok tb@
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index 9796cf397f..c90dd161f8 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_lib.c,v 1.50 2024/02/16 14:40:18 jsing Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.51 2024/02/17 14:29:07 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -136,28 +136,17 @@ BIO_new(const BIO_METHOD *method) | |||
136 | { | 136 | { |
137 | BIO *bio = NULL; | 137 | BIO *bio = NULL; |
138 | 138 | ||
139 | /* XXX calloc */ | 139 | if ((bio = calloc(1, sizeof(BIO))) == NULL) { |
140 | bio = malloc(sizeof(BIO)); | ||
141 | if (bio == NULL) { | ||
142 | BIOerror(ERR_R_MALLOC_FAILURE); | 140 | BIOerror(ERR_R_MALLOC_FAILURE); |
143 | return NULL; | 141 | return NULL; |
144 | } | 142 | } |
143 | |||
145 | bio->method = method; | 144 | bio->method = method; |
146 | bio->callback = NULL; | ||
147 | bio->callback_ex = NULL; | ||
148 | bio->cb_arg = NULL; | ||
149 | bio->init = 0; | ||
150 | bio->shutdown = 1; | 145 | bio->shutdown = 1; |
151 | bio->flags = 0; | ||
152 | bio->retry_reason = 0; | ||
153 | bio->num = 0; | ||
154 | bio->ptr = NULL; | ||
155 | bio->prev_bio = NULL; | ||
156 | bio->next_bio = NULL; | ||
157 | bio->references = 1; | 146 | bio->references = 1; |
158 | bio->num_read = 0L; | 147 | |
159 | bio->num_write = 0L; | ||
160 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data); | 148 | CRYPTO_new_ex_data(CRYPTO_EX_INDEX_BIO, bio, &bio->ex_data); |
149 | |||
161 | if (method->create != NULL) { | 150 | if (method->create != NULL) { |
162 | if (!method->create(bio)) { | 151 | if (!method->create(bio)) { |
163 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio, | 152 | CRYPTO_free_ex_data(CRYPTO_EX_INDEX_BIO, bio, |