   /*
    * If something bad happened then we will dump the contents of the
    * OpenSSL error stack to stderr. There might be some useful diagnostic
    * information there.
    */
   if (res == EXIT_FAILURE)
       ERR_print_errors_fp(stderr);

   /*
    * Free the resources we allocated. We do not free the BIO object here
    * because ownership of it was immediately transferred to the SSL object
    * via SSL_set_bio(). The BIO will be freed when we free the SSL object.
    */
   SSL_free(ssl);
   SSL_