Don't double free the write bio

When setting the read bio we free up any old existing one. However this can
lead to a double free if the existing one is the same as the write bio.

Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Matt Caswell 2016-07-21 10:28:24 +01:00
parent 7fb4c82035
commit 8e3854ac88

View File

@ -1045,7 +1045,7 @@ void SSL_free(SSL *s)
void SSL_set_rbio(SSL *s, BIO *rbio)
{
if (s->rbio != rbio)
if (s->rbio != rbio && s->rbio != s->wbio)
BIO_free_all(s->rbio);
s->rbio = rbio;
}