summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-05-29 14:43:34 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-05-29 14:43:34 +0000
commite47a93fbe6ff2f3a4d4e5516cf809d11c61e17c9 (patch)
tree3569969c94614873325a575c63e9ababdbba429f /lib
parentcc11d58cfe9c2712c5abce46b8dab7224c31fccb (diff)
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')
-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
}