summaryrefslogtreecommitdiffstats
path: root/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2014-05-29 14:43:33 +0000
committerjsing <jsing@openbsd.org>2014-05-29 14:43:33 +0000
commit7aed837606fe293db660cdb85dbb3ff126cf726e (patch)
tree6489568a164516ef1f7a8d64f7588d6058dc262e /lib/libssl/ssl_lib.c
parentdocument control characters which are extensions; (diff)
downloadwireguard-openbsd-7aed837606fe293db660cdb85dbb3ff126cf726e.tar.xz
wireguard-openbsd-7aed837606fe293db660cdb85dbb3ff126cf726e.zip
When you have functions that perform specific functions, use them.
EVP_CIPHER_CTX_free() does a NULL check, then calls EVP_CIPHER_CTX_cleanup() and frees the memory. COMP_CTX_free() also had its own NULL check, so there is no point in duplicating that here. ok beck@
Diffstat (limited to 'lib/libssl/ssl_lib.c')
-rw-r--r--lib/libssl/ssl_lib.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/lib/libssl/ssl_lib.c b/lib/libssl/ssl_lib.c
index 12d45ea0251..f1c92ee2f62 100644
--- a/lib/libssl/ssl_lib.c
+++ b/lib/libssl/ssl_lib.c
@@ -2726,25 +2726,16 @@ SSL_dup(SSL *s)
void
ssl_clear_cipher_ctx(SSL *s)
{
- if (s->enc_read_ctx != NULL) {
- EVP_CIPHER_CTX_cleanup(s->enc_read_ctx);
- free(s->enc_read_ctx);
- s->enc_read_ctx = NULL;
- }
- if (s->enc_write_ctx != NULL) {
- EVP_CIPHER_CTX_cleanup(s->enc_write_ctx);
- free(s->enc_write_ctx);
- s->enc_write_ctx = NULL;
- }
+ EVP_CIPHER_CTX_free(s->enc_read_ctx);
+ s->enc_read_ctx = NULL;
+ EVP_CIPHER_CTX_free(s->enc_write_ctx);
+ s->enc_write_ctx = NULL;
+
#ifndef OPENSSL_NO_COMP
- if (s->expand != NULL) {
- COMP_CTX_free(s->expand);
- s->expand = NULL;
- }
- if (s->compress != NULL) {
- COMP_CTX_free(s->compress);
- s->compress = NULL;
- }
+ COMP_CTX_free(s->expand);
+ s->expand = NULL;
+ COMP_CTX_free(s->compress);
+ s->compress = NULL;
#endif
}