aboutsummaryrefslogtreecommitdiff
path: root/test/ssltest.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-08-25 13:25:58 -0400
committerRich Salz <rsalz@openssl.org>2015-09-02 22:05:37 -0400
commitb51bce942023325e727ca4225252d06c49d8f2b7 (patch)
tree59bbdee7553f9132a86aca17752a9a358a6355e2 /test/ssltest.c
parent66e87a9f0990198079bf4d2b3ce87581ad5b6b10 (diff)
downloadopenssl-b51bce942023325e727ca4225252d06c49d8f2b7.zip
openssl-b51bce942023325e727ca4225252d06c49d8f2b7.tar.gz
openssl-b51bce942023325e727ca4225252d06c49d8f2b7.tar.bz2
Add and use OPENSSL_zalloc
There are many places (nearly 50) where we malloc and then memset. Add an OPENSSL_zalloc routine to encapsulate that. (Missed one conversion; thanks Richard) Also fixes GH328 Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'test/ssltest.c')
-rw-r--r--test/ssltest.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/test/ssltest.c b/test/ssltest.c
index 9144191..adf1368 100644
--- a/test/ssltest.c
+++ b/test/ssltest.c
@@ -2116,14 +2116,11 @@ int doit(SSL *s_ssl, SSL *c_ssl, long count)
bufsiz = count > 40 * 1024 ? 40 * 1024 : count;
- if ((cbuf = OPENSSL_malloc(bufsiz)) == NULL)
+ if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL)
goto err;
- if ((sbuf = OPENSSL_malloc(bufsiz)) == NULL)
+ if ((sbuf = OPENSSL_zalloc(bufsiz)) == NULL)
goto err;
- memset(cbuf, 0, bufsiz);
- memset(sbuf, 0, bufsiz);
-
c_to_s = BIO_new(BIO_s_mem());
s_to_c = BIO_new(BIO_s_mem());
if ((s_to_c == NULL) || (c_to_s == NULL)) {