Hi, the ocumentation about BIO_new_bio_pair seems confusing. The doc
at https://www.openssl.org/docs/crypto/BIO_s_bio.html clearly says:
----------------------------
Both halves of a BIO pair should be freed. That is even if one half is
implicit freed due to a BIO_free_all() or SSL_free() call the other
half needs to be freed.
EXAMPLE
BIO *internal_bio, *network_bio;
BIO_new_bio_pair(internal_bio, 0, network_bio, 0);
SSL_set_bio(ssl, internal_bio, internal_bio);
...
SSL_free(ssl); /* implicitly frees internal_bio */
BIO_free(network_bio);
----------------------------
First of all the example in the doc is wrong:
--------------
BIO *internal_bio, *network_bio;
BIO_new_bio_pair(internal_bio, 0, network_bio, 0);
--------------
It should be:
--------------
BIO *internal_bio, *network_bio;
BIO_new_bio_pair(&internal_bio, 0, &network_bio, 0);
--------------
Is it true that I must call to BIO_free(network_bio)? The SSL_free()
code "seems" to do it by itself!:
--------------------------
void SSL_free(SSL *s)
{
...
if (s->rbio != NULL)
BIO_free_all(s->rbio);
if ((s->wbio != NULL) && (s->wbio != s->rbio))
BIO_free_all(s->wbio);
--------------------------
--
Iñaki Baz Castillo
<[email protected]>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [email protected]
Automated List Manager [email protected]