The server forks out a thread and i am passing a pointer to the ssl object as a 
parameter to the thread which closes it just before exit. Like this

Servermain()
{
        CreateThread( SSL* ssl );       //user defined function
}

MyThread( void* p )
{
SSL *ssl = (SSL*)p;

//
//do something
//

If(ssl)
SSL_free(ssl);

Return ;
}

Is this OK? And also is there any sequence that should be followed for these 
cleanup routines.

-----Original Message-----
From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] 
On Behalf Of Kyle Hamilton
Sent: 23 June 2009 00:25
To: openssl-users@openssl.org
Subject: Re: memory leak in openssl

It looks like you did not do an SSL_free when the connection was shut down.

-Kyle H

On Mon, Jun 22, 2009 at 1:16 AM, Vivek Subbarao<viv...@chelsio.com> wrote:
> Hi,
>
>
>
> I am using openssl 0.9.8e that comes along with the linux rhel 5 u3 OS. We
> have a client server architecture where both the client and server use
> openssl for communication. When i run my server through valgrind i get the
> following error messages. Please do advice me on what i need to do to get
> rid of them.
>
>
>
> 18,698 bytes in 1 blocks are still reachable in loss record 618 of 618
>
> ==5253==    at 0x4A05809: malloc (vg_replace_malloc.c:149)
>
> ==5253==    by 0x359E6DAB51: CRYPTO_malloc (in /lib64/libcrypto.so.0.9.8e)
>
> ==5253==    by 0x35A2821991: ssl3_setup_buffers (in /lib64/libssl.so.0.9.8e)
>
> ==5253==    by 0x35A28229D5: ssl23_get_client_hello (in
> /lib64/libssl.so.0.9.8e)
>
> ==5253==    by 0x35A2822CF8: ssl23_accept (in /lib64/libssl.so.0.9.8e)
>
> ==5253==    by 0x40B558: main (server.cpp:1110)
>
>
>
> I do cleanup when my server exits. Here is my cleanup code
>
> ERR_free_strings();
>
> ENGINE_cleanup();
>
> EVP_cleanup();
>
> CONF_modules_finish();
>
> CONF_modules_free();
>
> CONF_modules_unload(1);
>
> CRYPTO_cleanup_all_ex_data();
>
>
>
>
>
> Thank You
>
> Vivek S
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org
:��I"Ϯ��r�m����
(����Z+�K�+����1���x��h����[�z�(����Z+���f�y�������f���h��)z{,���

Reply via email to