summaryrefslogtreecommitdiff
path: root/lib/libssl
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2017-04-10 16:47:09 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2017-04-10 16:47:09 +0000
commit99f8264c352daf39a2bcd2dd8854c151cba3ba3a (patch)
tree9784465b924feebeae45d09a22863d8df75c2a2f /lib/libssl
parent3b50186990314e1f83d90f89fded66ae57df1ba7 (diff)
Use freezero() for i2d_SSL_SESSION() - one line of code instead of three.
In this case the memory allocated can also be significant, in which case freezero() will have less overhead than explicit_bzero() (munmap instead of touching all of the memory to write zeros).
Diffstat (limited to 'lib/libssl')
-rw-r--r--lib/libssl/ssl_asn1.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/libssl/ssl_asn1.c b/lib/libssl/ssl_asn1.c
index 4014bf6fe66..5110ca3cc81 100644
--- a/lib/libssl/ssl_asn1.c
+++ b/lib/libssl/ssl_asn1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_asn1.c,v 1.49 2017/02/07 02:08:38 beck Exp $ */
+/* $OpenBSD: ssl_asn1.c,v 1.50 2017/04/10 16:47:08 jsing Exp $ */
/*
* Copyright (c) 2016 Joel Sing <jsing@openbsd.org>
@@ -205,12 +205,9 @@ i2d_SSL_SESSION(SSL_SESSION *s, unsigned char **pp)
rv = (int)data_len;
err:
- if (data != NULL)
- explicit_bzero(data, data_len);
-
CBB_cleanup(&session);
+ freezero(data, data_len);
free(peer_cert_bytes);
- free(data);
return rv;
}