summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authortb <>2023-12-25 21:25:24 +0000
committertb <>2023-12-25 21:25:24 +0000
commit72e7392b981301719f6e0c2310ef0290b821e603 (patch)
tree93651235318daad33f9291bb5654399931a41c67 /src/lib
parent53ad48e811d1b8cc7a91ecfa8145e1f3421a3fa2 (diff)
downloadopenbsd-72e7392b981301719f6e0c2310ef0290b821e603.tar.gz
openbsd-72e7392b981301719f6e0c2310ef0290b821e603.tar.bz2
openbsd-72e7392b981301719f6e0c2310ef0290b821e603.zip
Switch EVP_PKEY_new() from malloc() to calloc()
ok jsing
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/evp/p_lib.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/lib/libcrypto/evp/p_lib.c b/src/lib/libcrypto/evp/p_lib.c
index 4591c05234..dce4dbd5a6 100644
--- a/src/lib/libcrypto/evp/p_lib.c
+++ b/src/lib/libcrypto/evp/p_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: p_lib.c,v 1.39 2023/11/29 21:35:57 tb Exp $ */ 1/* $OpenBSD: p_lib.c,v 1.40 2023/12/25 21:25:24 tb 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 *
@@ -197,19 +197,17 @@ EVP_PKEY_new(void)
197{ 197{
198 EVP_PKEY *ret; 198 EVP_PKEY *ret;
199 199
200 ret = malloc(sizeof(EVP_PKEY)); 200 if ((ret = calloc(1, sizeof(*ret))) == NULL) {
201 if (ret == NULL) {
202 EVPerror(ERR_R_MALLOC_FAILURE); 201 EVPerror(ERR_R_MALLOC_FAILURE);
203 return (NULL); 202 return NULL;
204 } 203 }
204
205 ret->type = EVP_PKEY_NONE; 205 ret->type = EVP_PKEY_NONE;
206 ret->save_type = EVP_PKEY_NONE; 206 ret->save_type = EVP_PKEY_NONE;
207 ret->references = 1; 207 ret->references = 1;
208 ret->ameth = NULL;
209 ret->pkey.ptr = NULL;
210 ret->attributes = NULL;
211 ret->save_parameters = 1; 208 ret->save_parameters = 1;
212 return (ret); 209
210 return ret;
213} 211}
214 212
215int 213int