diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-06-20 15:44:03 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-06-23 22:24:09 +0100 |
commit | c72382048f8e6bfea1fbe1b2e25a0423182bb4f0 (patch) | |
tree | 21565813a0852ed837358a5df00cb9492f258aa1 /ssl | |
parent | 124037fdc0571b5bd9022412348e9979a1726a31 (diff) | |
download | openssl-c72382048f8e6bfea1fbe1b2e25a0423182bb4f0.tar.gz |
Avoid duplication.
We always free the handshake buffer when digests are freed so move
it into ssl_free_digest_list()
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/s3_enc.c | 8 | ||||
-rw-r--r-- | ssl/s3_lib.c | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ssl/s3_enc.c b/ssl/s3_enc.c index 5e52af827b..02e07bac94 100644 --- a/ssl/s3_enc.c +++ b/ssl/s3_enc.c @@ -476,15 +476,21 @@ void ssl3_cleanup_key_block(SSL *s) void ssl3_init_finished_mac(SSL *s) { - BIO_free(s->s3->handshake_buffer); ssl3_free_digest_list(s); s->s3->handshake_buffer = BIO_new(BIO_s_mem()); (void)BIO_set_close(s->s3->handshake_buffer, BIO_CLOSE); } +/* + * Free digest list. Also frees handshake buffer since they are always freed + * together. + */ + void ssl3_free_digest_list(SSL *s) { int i; + BIO_free(s->s3->handshake_buffer); + s->s3->handshake_buffer = NULL; if (!s->s3->handshake_dgst) return; for (i = 0; i < SSL_MAX_DIGEST; i++) { diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index 6febd4e316..bc780c1f14 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -2911,7 +2911,6 @@ void ssl3_free(SSL *s) OPENSSL_free(s->s3->tmp.ciphers_raw); OPENSSL_clear_free(s->s3->tmp.pms, s->s3->tmp.pmslen); OPENSSL_free(s->s3->tmp.peer_sigalgs); - BIO_free(s->s3->handshake_buffer); ssl3_free_digest_list(s); OPENSSL_free(s->s3->alpn_selected); @@ -2955,8 +2954,6 @@ void ssl3_clear(SSL *s) #endif /* !OPENSSL_NO_EC */ init_extra = s->s3->init_extra; - BIO_free(s->s3->handshake_buffer); - s->s3->handshake_buffer = NULL; ssl3_free_digest_list(s); if (s->s3->alpn_selected) { |