summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-07-09 16:59:34 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-07-09 16:59:34 +0000
commitac00eb18cc3b9ae3138843ea2c94287512942b5d (patch)
treed110c17c0cae0c24ac7fd133483faa02dfeac43a /lib
parentc73b45689db7f57db4a9ca049eb037289b29b29c (diff)
{malloc,reallocarray} + memset(,0,) -> calloc
ok tedu@
Diffstat (limited to 'lib')
-rw-r--r--lib/libssl/src/crypto/store/str_mem.c6
-rw-r--r--lib/libssl/src/crypto/x509v3/pcy_tree.c6
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/libssl/src/crypto/store/str_mem.c b/lib/libssl/src/crypto/store/str_mem.c
index 4eb707c5a9d..3f32bcb8d09 100644
--- a/lib/libssl/src/crypto/store/str_mem.c
+++ b/lib/libssl/src/crypto/store/str_mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: str_mem.c,v 1.8 2014/06/12 15:49:30 deraadt Exp $ */
+/* $OpenBSD: str_mem.c,v 1.9 2014/07/09 16:59:33 miod Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
* project 2003.
*/
@@ -224,15 +224,15 @@ static void *
mem_list_start(STORE *s, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[],
OPENSSL_ITEM parameters[])
{
- struct mem_ctx_st *context = malloc(sizeof(struct mem_ctx_st));
+ struct mem_ctx_st *context;
void *attribute_context = NULL;
STORE_ATTR_INFO *attrs = NULL;
+ context = calloc(1, sizeof(struct mem_ctx_st));
if (!context) {
STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE);
return 0;
}
- memset(context, 0, sizeof(struct mem_ctx_st));
attribute_context = STORE_parse_attrs_start(attributes);
if (!attribute_context) {
diff --git a/lib/libssl/src/crypto/x509v3/pcy_tree.c b/lib/libssl/src/crypto/x509v3/pcy_tree.c
index 8627429d6c0..aaf27e98024 100644
--- a/lib/libssl/src/crypto/x509v3/pcy_tree.c
+++ b/lib/libssl/src/crypto/x509v3/pcy_tree.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcy_tree.c,v 1.10 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: pcy_tree.c,v 1.11 2014/07/09 16:59:33 miod Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2004.
*/
@@ -220,7 +220,7 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
return 0;
tree->flags = 0;
- tree->levels = reallocarray(NULL, n, sizeof(X509_POLICY_LEVEL));
+ tree->levels = calloc(n, sizeof(X509_POLICY_LEVEL));
tree->nlevel = 0;
tree->extra_data = NULL;
tree->auth_policies = NULL;
@@ -231,8 +231,6 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
return 0;
}
- memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL));
-
tree->nlevel = n;
level = tree->levels;