summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2017-03-16 13:15:06 +0000
committerjsing <>2017-03-16 13:15:06 +0000
commit9876415607a0e48169e9eaf668be954816a65715 (patch)
tree471fc8c571b480f12cbb410867411f5ba0672e75
parent7b20b215f3a44749f2786d6be674f4f36edb1454 (diff)
downloadopenbsd-9876415607a0e48169e9eaf668be954816a65715.tar.gz
openbsd-9876415607a0e48169e9eaf668be954816a65715.tar.bz2
openbsd-9876415607a0e48169e9eaf668be954816a65715.zip
Use calloc() instead of malloc() followed by manually zeroing fields.
ok beck@ inoguchi@
-rw-r--r--src/lib/libcrypto/buffer/buffer.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/lib/libcrypto/buffer/buffer.c b/src/lib/libcrypto/buffer/buffer.c
index e32abb14f3..ddc8f39408 100644
--- a/src/lib/libcrypto/buffer/buffer.c
+++ b/src/lib/libcrypto/buffer/buffer.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: buffer.c,v 1.22 2017/01/29 17:49:22 beck Exp $ */ 1/* $OpenBSD: buffer.c,v 1.23 2017/03/16 13:15:06 jsing 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 *
@@ -73,14 +73,11 @@ BUF_MEM_new(void)
73{ 73{
74 BUF_MEM *ret; 74 BUF_MEM *ret;
75 75
76 ret = malloc(sizeof(BUF_MEM)); 76 if ((ret = calloc(1, sizeof(BUF_MEM))) == NULL) {
77 if (ret == NULL) {
78 BUFerror(ERR_R_MALLOC_FAILURE); 77 BUFerror(ERR_R_MALLOC_FAILURE);
79 return (NULL); 78 return (NULL);
80 } 79 }
81 ret->length = 0; 80
82 ret->max = 0;
83 ret->data = NULL;
84 return (ret); 81 return (ret);
85} 82}
86 83