Hello, the simple piece of code below results in "4243 bytes leaked in 280 chunks" as reported by the CRYPTO debug memory functions.
 
Most leaks are caused by the call to SSLeay_add_all_algorithms.
Some leaks are caused by the calls to the CRYPTO debug memory functions, but I can  live with that.
 
Am I missing some mandatory cleanup call? Anyone has tested for mem leaks on other platforms? Any advice, experience?
 
Thanks
Here is the code:
 
int main(int argc, char **argv)
{
    char*   buf;
    BIO*    pBioErr;
 
    _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);    /* win32 specific */
 
 pBioErr = BIO_new_fp(stderr,BIO_NOCLOSE);
 
    /* init crypto mem management and turn checking on */
 
#ifdef CRYPTO_MDEBUG
    CRYPTO_malloc_debug_init();
    CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
#else
    CRYPTO_malloc_init();
#endif
 
    buf = Malloc(255);  /* dummy alloc */
 
    /* load all crypto algorithms */
 
    SSLeay_add_all_algorithms();
 
    /* print mem leaks & exit */
 
#ifdef CRYPTO_MDEBUG
    CRYPTO_mem_leaks(pBioErr);
#endif
    BIO_free(pBioErr);
    _CrtDumpMemoryLeaks( );     /* win32 specific */
}
________________________________
Richard Dykiel, Starburst Software
150 Baker Avenue, Concord, MA 01742
http://www.starburstsoftware.com
1-800-585-3889 ext289

Reply via email to