title: Free string returned by X509_NAME_oneline
body: <p>I am trying to use a simple SSL example.</p>
  
  <p>This is some code:</p>
  
  <pre><code>void ShowCerts(SSL* ssl)
  {
      X509 *cert;
      char *line;
  
      cert = SSL_get_peer_certificate(ssl); /* get the server's certificate */
      if ( cert != NULL )
      {
          printf("Server certificates:\n");
          line = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0);
          printf("Subject: %s\n", line);
          free(line);       /* free the malloc'ed string */
          line = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
          printf("Issuer: %s\n", line);
          free(line);       /* free the malloc'ed string */
          X509_free(cert);     /* free the malloc'ed certificate copy */
      }
      else
          printf("No certificates.\n");
  }
  </code></pre>
  
  <p>Program crashes in the <code>free(line)</code> lines of code. Without these lines, the  program works without crashes. If I remove these lines I am afraid in this case that some allocated resources will not be freed - what should I do ?</p>
  
  <p>Thanks.</p>