Karim Sharif via RT wrote:
> Hello,
>  
> I would like to report a memory leak in SSL_connect(). Following code
> sample was check for memory leaks
> using "Purify" and show a 13K leak in SSL_connect().

did you read the "* I think I've detected a memory leak, is this a bug?"
item in the FAQ ?

Didn't purify give you a somewhat more precise description where
the mem leak is ?

...
>     peer = SSL_get_peer_certificate(servercon);
>     if (peer != NULL) {
>         memset(sname, 0, sizeof(sname));
>         X509_NAME_oneline(X509_get_subject_name(peer), sname, 400);
>  
>         memset(iname, 0, sizeof(iname));
>         X509_NAME_oneline(X509_get_issuer_name(peer), iname, 400);
>  
>         memset(peerCN, 0, sizeof(peerCN));
>         X509_NAME_get_text_by_NID(X509_get_subject_name(peer), 13,
> peerCN, 256);
>     }
>  
>     SSL_free(servercon);
>     SSL_CTX_free(ssl_ctx);

at least a "X509_free(peer);" is missing here, as SSL_get_peer_certificate
increases the reference counter of the X509 object.

>     return 1;
> }

Cheers,
Nils

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to