summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormiod <>2014-07-09 16:59:33 +0000
committermiod <>2014-07-09 16:59:33 +0000
commit6bd740d00a7a8c72fcdff64eae6ee0fa2e8a812b (patch)
treeaf0814dce08d495b4ca67d0bea871ef75e5eece2 /src
parentf59c1cbd128b4f845eaae29dda7f1c2a2853edd8 (diff)
downloadopenbsd-6bd740d00a7a8c72fcdff64eae6ee0fa2e8a812b.tar.gz
openbsd-6bd740d00a7a8c72fcdff64eae6ee0fa2e8a812b.tar.bz2
openbsd-6bd740d00a7a8c72fcdff64eae6ee0fa2e8a812b.zip
{malloc,reallocarray} + memset(,0,) -> calloc
ok tedu@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/store/str_mem.c6
-rw-r--r--src/lib/libcrypto/x509v3/pcy_tree.c6
-rw-r--r--src/lib/libssl/src/crypto/store/str_mem.c6
-rw-r--r--src/lib/libssl/src/crypto/x509v3/pcy_tree.c6
4 files changed, 10 insertions, 14 deletions
diff --git a/src/lib/libcrypto/store/str_mem.c b/src/lib/libcrypto/store/str_mem.c
index 4eb707c5a9..3f32bcb8d0 100644
--- a/src/lib/libcrypto/store/str_mem.c
+++ b/src/lib/libcrypto/store/str_mem.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: str_mem.c,v 1.8 2014/06/12 15:49:30 deraadt Exp $ */ 1/* $OpenBSD: str_mem.c,v 1.9 2014/07/09 16:59:33 miod Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003. 3 * project 2003.
4 */ 4 */
@@ -224,15 +224,15 @@ static void *
224mem_list_start(STORE *s, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], 224mem_list_start(STORE *s, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[],
225 OPENSSL_ITEM parameters[]) 225 OPENSSL_ITEM parameters[])
226{ 226{
227 struct mem_ctx_st *context = malloc(sizeof(struct mem_ctx_st)); 227 struct mem_ctx_st *context;
228 void *attribute_context = NULL; 228 void *attribute_context = NULL;
229 STORE_ATTR_INFO *attrs = NULL; 229 STORE_ATTR_INFO *attrs = NULL;
230 230
231 context = calloc(1, sizeof(struct mem_ctx_st));
231 if (!context) { 232 if (!context) {
232 STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE); 233 STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE);
233 return 0; 234 return 0;
234 } 235 }
235 memset(context, 0, sizeof(struct mem_ctx_st));
236 236
237 attribute_context = STORE_parse_attrs_start(attributes); 237 attribute_context = STORE_parse_attrs_start(attributes);
238 if (!attribute_context) { 238 if (!attribute_context) {
diff --git a/src/lib/libcrypto/x509v3/pcy_tree.c b/src/lib/libcrypto/x509v3/pcy_tree.c
index 8627429d6c..aaf27e9802 100644
--- a/src/lib/libcrypto/x509v3/pcy_tree.c
+++ b/src/lib/libcrypto/x509v3/pcy_tree.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pcy_tree.c,v 1.10 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: pcy_tree.c,v 1.11 2014/07/09 16:59:33 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2004. 3 * project 2004.
4 */ 4 */
@@ -220,7 +220,7 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
220 return 0; 220 return 0;
221 221
222 tree->flags = 0; 222 tree->flags = 0;
223 tree->levels = reallocarray(NULL, n, sizeof(X509_POLICY_LEVEL)); 223 tree->levels = calloc(n, sizeof(X509_POLICY_LEVEL));
224 tree->nlevel = 0; 224 tree->nlevel = 0;
225 tree->extra_data = NULL; 225 tree->extra_data = NULL;
226 tree->auth_policies = NULL; 226 tree->auth_policies = NULL;
@@ -231,8 +231,6 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
231 return 0; 231 return 0;
232 } 232 }
233 233
234 memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL));
235
236 tree->nlevel = n; 234 tree->nlevel = n;
237 235
238 level = tree->levels; 236 level = tree->levels;
diff --git a/src/lib/libssl/src/crypto/store/str_mem.c b/src/lib/libssl/src/crypto/store/str_mem.c
index 4eb707c5a9..3f32bcb8d0 100644
--- a/src/lib/libssl/src/crypto/store/str_mem.c
+++ b/src/lib/libssl/src/crypto/store/str_mem.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: str_mem.c,v 1.8 2014/06/12 15:49:30 deraadt Exp $ */ 1/* $OpenBSD: str_mem.c,v 1.9 2014/07/09 16:59:33 miod Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2003. 3 * project 2003.
4 */ 4 */
@@ -224,15 +224,15 @@ static void *
224mem_list_start(STORE *s, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[], 224mem_list_start(STORE *s, STORE_OBJECT_TYPES type, OPENSSL_ITEM attributes[],
225 OPENSSL_ITEM parameters[]) 225 OPENSSL_ITEM parameters[])
226{ 226{
227 struct mem_ctx_st *context = malloc(sizeof(struct mem_ctx_st)); 227 struct mem_ctx_st *context;
228 void *attribute_context = NULL; 228 void *attribute_context = NULL;
229 STORE_ATTR_INFO *attrs = NULL; 229 STORE_ATTR_INFO *attrs = NULL;
230 230
231 context = calloc(1, sizeof(struct mem_ctx_st));
231 if (!context) { 232 if (!context) {
232 STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE); 233 STOREerr(STORE_F_MEM_LIST_START, ERR_R_MALLOC_FAILURE);
233 return 0; 234 return 0;
234 } 235 }
235 memset(context, 0, sizeof(struct mem_ctx_st));
236 236
237 attribute_context = STORE_parse_attrs_start(attributes); 237 attribute_context = STORE_parse_attrs_start(attributes);
238 if (!attribute_context) { 238 if (!attribute_context) {
diff --git a/src/lib/libssl/src/crypto/x509v3/pcy_tree.c b/src/lib/libssl/src/crypto/x509v3/pcy_tree.c
index 8627429d6c..aaf27e9802 100644
--- a/src/lib/libssl/src/crypto/x509v3/pcy_tree.c
+++ b/src/lib/libssl/src/crypto/x509v3/pcy_tree.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pcy_tree.c,v 1.10 2014/06/12 15:49:31 deraadt Exp $ */ 1/* $OpenBSD: pcy_tree.c,v 1.11 2014/07/09 16:59:33 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2004. 3 * project 2004.
4 */ 4 */
@@ -220,7 +220,7 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
220 return 0; 220 return 0;
221 221
222 tree->flags = 0; 222 tree->flags = 0;
223 tree->levels = reallocarray(NULL, n, sizeof(X509_POLICY_LEVEL)); 223 tree->levels = calloc(n, sizeof(X509_POLICY_LEVEL));
224 tree->nlevel = 0; 224 tree->nlevel = 0;
225 tree->extra_data = NULL; 225 tree->extra_data = NULL;
226 tree->auth_policies = NULL; 226 tree->auth_policies = NULL;
@@ -231,8 +231,6 @@ tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs, unsigned int flags)
231 return 0; 231 return 0;
232 } 232 }
233 233
234 memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL));
235
236 tree->nlevel = n; 234 tree->nlevel = n;
237 235
238 level = tree->levels; 236 level = tree->levels;