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>
This commit is contained in:
parent
85fb6fdaed
commit
d480e182fe
@ -476,15 +476,21 @@ void ssl3_cleanup_key_block(SSL *s)
|
|||||||
|
|
||||||
void ssl3_init_finished_mac(SSL *s)
|
void ssl3_init_finished_mac(SSL *s)
|
||||||
{
|
{
|
||||||
BIO_free(s->s3->handshake_buffer);
|
|
||||||
ssl3_free_digest_list(s);
|
ssl3_free_digest_list(s);
|
||||||
s->s3->handshake_buffer = BIO_new(BIO_s_mem());
|
s->s3->handshake_buffer = BIO_new(BIO_s_mem());
|
||||||
(void)BIO_set_close(s->s3->handshake_buffer, BIO_CLOSE);
|
(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)
|
void ssl3_free_digest_list(SSL *s)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
BIO_free(s->s3->handshake_buffer);
|
||||||
|
s->s3->handshake_buffer = NULL;
|
||||||
if (!s->s3->handshake_dgst)
|
if (!s->s3->handshake_dgst)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < SSL_MAX_DIGEST; i++) {
|
for (i = 0; i < SSL_MAX_DIGEST; i++) {
|
||||||
|
@ -2905,7 +2905,6 @@ void ssl3_free(SSL *s)
|
|||||||
OPENSSL_free(s->s3->tmp.ciphers_raw);
|
OPENSSL_free(s->s3->tmp.ciphers_raw);
|
||||||
OPENSSL_clear_free(s->s3->tmp.pms, s->s3->tmp.pmslen);
|
OPENSSL_clear_free(s->s3->tmp.pms, s->s3->tmp.pmslen);
|
||||||
OPENSSL_free(s->s3->tmp.peer_sigalgs);
|
OPENSSL_free(s->s3->tmp.peer_sigalgs);
|
||||||
BIO_free(s->s3->handshake_buffer);
|
|
||||||
ssl3_free_digest_list(s);
|
ssl3_free_digest_list(s);
|
||||||
OPENSSL_free(s->s3->alpn_selected);
|
OPENSSL_free(s->s3->alpn_selected);
|
||||||
|
|
||||||
@ -2940,8 +2939,6 @@ void ssl3_clear(SSL *s)
|
|||||||
#endif /* !OPENSSL_NO_EC */
|
#endif /* !OPENSSL_NO_EC */
|
||||||
|
|
||||||
init_extra = s->s3->init_extra;
|
init_extra = s->s3->init_extra;
|
||||||
BIO_free(s->s3->handshake_buffer);
|
|
||||||
s->s3->handshake_buffer = NULL;
|
|
||||||
ssl3_free_digest_list(s);
|
ssl3_free_digest_list(s);
|
||||||
|
|
||||||
if (s->s3->alpn_selected) {
|
if (s->s3->alpn_selected) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user