summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/crypto_ex_data.c
diff options
context:
space:
mode:
authortb <>2024-08-03 07:43:33 +0000
committertb <>2024-08-03 07:43:33 +0000
commitd7b328b513d2128dfbee9482c01b4e22de59f428 (patch)
treed1b7bafeb2ca0447c6507d223748bcc0b5dda766 /src/lib/libcrypto/crypto_ex_data.c
parentc5cce4f85801410d87d47722625066f208fe6e64 (diff)
downloadopenbsd-d7b328b513d2128dfbee9482c01b4e22de59f428.tar.gz
openbsd-d7b328b513d2128dfbee9482c01b4e22de59f428.tar.bz2
openbsd-d7b328b513d2128dfbee9482c01b4e22de59f428.zip
Use proper size for allocating indexes
It's a double pointer, so we should allocate a pointer size, not the entire struct. This saves roughly 500B per class. CID 507397 ok jsing
Diffstat (limited to 'src/lib/libcrypto/crypto_ex_data.c')
-rw-r--r--src/lib/libcrypto/crypto_ex_data.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/crypto_ex_data.c b/src/lib/libcrypto/crypto_ex_data.c
index 2b3e28fac2..2c89f70fa9 100644
--- a/src/lib/libcrypto/crypto_ex_data.c
+++ b/src/lib/libcrypto/crypto_ex_data.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: crypto_ex_data.c,v 1.2 2024/08/02 14:02:33 tb Exp $ */ 1/* $OpenBSD: crypto_ex_data.c,v 1.3 2024/08/03 07:43:33 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -104,7 +104,7 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
104 sizeof(struct crypto_ex_data_class))) == NULL) 104 sizeof(struct crypto_ex_data_class))) == NULL)
105 goto err; 105 goto err;
106 if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX, 106 if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX,
107 sizeof(struct crypto_ex_data_index))) == NULL) 107 sizeof(struct crypto_ex_data_index *))) == NULL)
108 goto err; 108 goto err;
109 new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX; 109 new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX;
110 new_class->next_index = 1; 110 new_class->next_index = 1;