Title: RE: memory leaks in openssl - urgent.......

hello
i tried to build my application with the latest function ERR_remove_state() from the snapshot from openssl site , as suggested , but still the memory leak remains as such..the new function looks like

void ERR_remove_state(unsigned long pid)
        {
        ERR_STATE *p,tmp;

        if (thread_hash == NULL)
                return;
        if (pid == 0)
                pid=(unsigned long)CRYPTO_thread_id();
        tmp.pid=pid;
        CRYPTO_w_lock(CRYPTO_LOCK_ERR);
        p=(ERR_STATE *)lh_delete(thread_hash,&tmp);
        if (lh_num_items(thread_hash) == 0)
                {
                /* make sure we don't leak memory */
                lh_free(thread_hash);
                thread_hash = NULL;
                }
        CRYPTO_w_unlock(CRYPTO_LOCK_ERR);

        if (p != NULL) ERR_STATE_free(p);
        }

thanx
meenakshi


-----Original Message-----
From: Dr Stephen Henson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 29, 2000 3:19 PM
To: [EMAIL PROTECTED]
Subject: Re: memory leaks in openssl - urgent.......


> Arora Meenakshi wrote:
>
> hello
> Please reply to this mail if anyone has any suggestions. i have posted
> this question a lot of times but no success so i am again giving it a
> try.
>
> i am running my openssl code in bounds checker & i am getting the
> memory leaks in*CRYPTO_malloc(int num, const char *file, int line).
>
> our product is in the release stage & we hae to somehow get rid of
> this memory leak soon  .
>
> clean up functions i am calling are:
>         SSL_shutdown (...);
>         closesocket(...);
>         SSL_free (...);
>         SSL_CTX_free (..);
>         WSACleanup( );
>         EVP_cleanup();
>         ERR_remove_state(0);
>         ERR_free_strings();
>         OBJ_NAME_cleanup(-1);
>
> & my sequence of openssl function is
> SSLeay_add_ssl_algorithms();
> RAND_screen();
> WSAStartup(versionRequested,&wsaData))
> SSLv2_client_method();
> SSL_CTX_new(...)
> socket(.........))
> ......
> connect(m_socketDescriptor,(struct
> sockaddr*)&m_sockAddr,sizeof(sockaddr)))
> m_pSSL = SSL_new(m_pSSLContext))
> SSL_connect(m_pSSL))
> ........
>

There was an issue relating to the thread_hash table that was mentioned
in these lists a while ago. ERR_remove_state() would remove a thread's
entries from the table but not the table itself.

It is an issue with OpenSSL 0.9.5a and probably previous versions also,
however since the leak cannot grow it is not a very serious problem.

It is fixed in the latest development version.

If this is the case then you can try replacing the crypto/err.c file
with one from the latest snapshot, or if it wont compile just the
function ERR_remove_state().

Steve.
--
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to