Hi,

Can any one of u guys tell me how to use the memory check support thing of
Openssl..
Following code does output the memory leaks, but how to read the output and
narrow the cause of memory leak..

Code:

void Openssl_Init()
{
        OpenSSL_add_all_algorithms();

        CRYPTO_malloc_debug_init();
        CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL);
        CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);

        g_pBioStdOut = BIO_new(BIO_s_file());
        BIO_set_fp(g_pBioStdOut, stdout, BIO_NOCLOSE);
        BIO_printf(g_pBioStdOut, "OpenSSL Application Starting.....\n");

        //g_fp = fopen("d:\\work\\MemoryLeaks.txt", "w");
}


void Openssl_Exit()
{
        BIO_printf(g_pBioStdOut, "OpenSSL Application Exiting.....\n");
        BIO_printf(g_pBioStdOut, "\n\n");
        BIO_free(g_pBioStdOut);

        CRYPTO_mem_leaks_fp(stderr);
        //CRYPTO_mem_leaks_fp(fp);
        ERR_free_strings();
        ERR_remove_state(0);
        EVP_cleanup(); 
        
        if(g_fp)
                fclose(g_fp);
}

Output:

[11:21:51]   245 file=.\crypto\err\err.c, line=696, thread=480, number=332,
addr
ess=00D0B830
[11:21:51]   248 file=.\crypto\lhash\lhash.c, line=193, thread=480,
number=12, a
ddress=00D0BC10
[11:21:51]   246 file=.\crypto\lhash\lhash.c, line=119, thread=480,
number=96, a
ddress=00D0B9E0
[11:21:51]   247 file=.\crypto\lhash\lhash.c, line=121, thread=480,
number=64, a
ddress=00D0BB08
504 bytes leaked in 4 chunks

Question: How to read this and figure out where excatly is the memory leak
??

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

Reply via email to