fix memory leak (BIO_free_all needs pointer to first BIO)