summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2024-08-03 07:43:34 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2024-08-03 07:43:34 +0000
commit3fce3c2651c022d61efd33294cd3ed50b6f69838 (patch)
tree04f36ea6fe78ab3fe3b206364cda7b27a0312817
parent98bb5836f5dc65c6af524d1d4cb2daa7def0d39a (diff)
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
-rw-r--r--lib/libcrypto/crypto_ex_data.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/crypto_ex_data.c b/lib/libcrypto/crypto_ex_data.c
index 2b3e28fac27..2c89f70fa91 100644
--- a/lib/libcrypto/crypto_ex_data.c
+++ b/lib/libcrypto/crypto_ex_data.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: crypto_ex_data.c,v 1.2 2024/08/02 14:02:33 tb Exp $ */
+/* $OpenBSD: crypto_ex_data.c,v 1.3 2024/08/03 07:43:33 tb Exp $ */
/*
* Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
*
@@ -104,7 +104,7 @@ CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
sizeof(struct crypto_ex_data_class))) == NULL)
goto err;
if ((new_class->indexes = calloc(CRYPTO_EX_DATA_MAX_INDEX,
- sizeof(struct crypto_ex_data_index))) == NULL)
+ sizeof(struct crypto_ex_data_index *))) == NULL)
goto err;
new_class->indexes_len = CRYPTO_EX_DATA_MAX_INDEX;
new_class->next_index = 1;