diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2014-05-29 14:43:34 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2014-05-29 14:43:34 +0000 |
commit | e47a93fbe6ff2f3a4d4e5516cf809d11c61e17c9 (patch) | |
tree | 3569969c94614873325a575c63e9ababdbba429f /lib | |
parent | cc11d58cfe9c2712c5abce46b8dab7224c31fccb (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.c | 27 |
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 } |