I think I've answered my own question... 
I was calling the crypto debug too much w/the initialization stuff. 
(CRYPTO_malloc_debug_init();
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);)

Sorry for the stupid post.  After I moved the debugging out of my init and destruction 
code, everything works! W/O a leak!

Thanks,
Fred Crable

-----Original Message-----
From: Fred Crable 
Sent: Monday, November 17, 2003 1:08 PM
To: '[EMAIL PROTECTED]'
Subject: SSL Setting session is leaking memory


I'm trying to follow all the examples & cache my client session.  If I uncomment the 
code below I get the session caching to work but the CRYTPO debug log shows leaks..  

If I leave the comments I get no caching BUT There aren't any leaks.  Am I missing 
something else, I've debugged & checked the reference counts, sslSession is a static 
SSL_SESSION *.  All of the leaks disappear when I try not to cache my session.  It 
appears to grow by several K for each transaction.  I can send more info if needed, 
but I've got to run to a meeting.

If I'm not "re-storing" the sslSession (because it's not zero) then what else could be 
leaking?

Thanks in advance,
Fred Crable

static SSL_SESSION *sslSession=0;
....
connectFunction(){
   /* bio stuff etc */
 
 /*  Comment leaky code --- Section 1 of 2
  *
  *
  if(sslSession){
      // Re-Connect and Resume session
      // This increments the reference
      SSL_set_session(m_ssl,sslSession);
  }
  */
  if(SSL_connect(m_ssl)<=0) {
      throw ConnectionError("SSL connect failed");
  }

  /* Another leak? --- Section 2 of 2
   * 
   *
  if(sslSession!=0){
      if(SSL_session_reused(m_ssl)==0){
          SSL_SESSION_free(sslSession);
          sslSession=SSL_get1_session(m_ssl);
      }
  }else{
      sslSession=SSL_get1_session(m_ssl);
  }
  */
}


Here are the leaks w/the code uncommented!

[14:48:48]  2409 file=a_object.c, line=242, thread=10223, number=3, address=081C
EBC0
[14:48:48]  2512 file=bn_lib.c, line=295, thread=10223, number=20, address=081D0
1C8
[14:48:48]  2435 file=bn_lib.c, line=328, thread=10223, number=264, address=081C
F2B8
[14:48:48]  2161 file=tasn_new.c, line=319, thread=10223, number=8, address=081C
9C20
[14:48:48]  2537 file=bn_lib.c, line=328, thread=10223, number=520, address=081D
08F0
[14:48:48]  2403 file=asn1_lib.c, line=346, thread=10223, number=11, address=081
CE9E0
[14:48:48]  2431 file=a_int.c, line=178, thread=10223, number=2, address=081CD9E
0
[14:48:48]  2269 file=a_object.c, line=268, thread=10223, number=24, address=081
A56D0
[14:48:48]  2156 file=asn1_lib.c, line=376, thread=10223, number=16, address=081
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to