I tried the cleanup calls advised by Bodo, it works fine so far as OpenSSL
is concerned; I tested the CRYPTO mem debug functions & I am now confident
they'll spot my bugs.
However I still have the following leaks reported by Win32's debugging
tools:
Detected memory leaks!
Dumping objects ->
{3409} normal block at 0x0090A8D0, 512 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{3447} normal block at 0x008C8758, 128 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{2596} normal block at 0x008FC880, 96 bytes long.
Data: < , @ @ A > D0 A8 90 00 2C 9C 40 00 AF 9C 40 00 41 00 00 00
{49} normal block at 0x008D1DA0, 96 bytes long.
Data: <X L@ M@ > 58 87 8C 00 FC 4C 40 00 0B 4D 40 00 10 00 00 00
Object dump complete.
Obviously they are lost in my startup/stop sequence, therefore it's not that
important. Perhaps I' still wrong? Here are my startup/stop functions:
int OpenSSLStart()
{
#ifdef CRYPTO_MDEBUG
_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); /* win32 specific */
#endif
/* init error BIO */
pBioErr = BIO_new_fp(stderr,BIO_NOCLOSE);
if (pBioErr == NULL)
return(1);
/* init OpenSSL debug tools */
#ifdef CRYPTO_MDEBUG
CRYPTO_malloc_debug_init();
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
#else
CRYPTO_malloc_init();
#endif
/* load error strings & all crypto algorithms */
ERR_load_crypto_strings();
SSLeay_add_all_algorithms();
return(0);
}
void OpenSSLStop()
{
EVP_cleanup();
ERR_remove_state(0);
ERR_free_strings();
/* print mem leaks */
#ifdef CRYPTO_MDEBUG
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF);
CRYPTO_mem_leaks(pBioErr);
#endif
BIO_free(pBioErr);
#ifdef CRYPTO_MDEBUG
_CrtDumpMemoryLeaks( ); /* win32 specific */
#endif
}
----- Original Message -----
From: Bodo Moeller <[EMAIL PROTECTED]>
To: Richard Dykiel <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, March 15, 2000 8:11 PM
Subject: Re: memory leaks in SSLeay_add_all_algorithms?
> Richard Dykiel <[EMAIL PROTECTED]>:
>
> > 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.
> [...]
> > Am I missing some mandatory cleanup call?
>
> Yes (as you can see by using the openssl command line tool,
> which calls SSLeay_add_all_algorithms after having enabled memory
> leak checking; see the definition of apps_startup in apps/apps.h).
> Call EVP_cleanup() before checking for memory leaks.
> (You'll also want to call ERR_remove_state and ERR_free_strings.)
> ______________________________________________________________________
> OpenSSL Project http://www.openssl.org
> User Support Mailing List [EMAIL PROTECTED]
> Automated List Manager [EMAIL PROTECTED]
>
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]