Hi,

Check the return value of SSL_shutdown(ssl). Sometimes it needs up to 4 
iterations to complete due to internal state machine. It completes when the 
value != 0. Hope it helps.

BR,
Nikos
  ----- Original Message ----- 
  From: Fabian Bergmark 
  To: openssl-users@openssl.org 
  Sent: Tuesday, May 05, 2009 9:13 PM
  Subject: Openssl Memory leak


  Hi

  I am currently writing a Chat application using the Openssl library for 
encryption. It's a multi-thread application and every client is managed by a 
different thread.
  However, ever since I implemented Openssl there seams to be a memory leak of 
around 10 kb.
  My openssl-code code is looking like following:

  SSL_set_bio(ssl,bio,bio);
  SSL_accept(ssl);
  SSL_shutdown(ssl);
  SSL_free(ssl);

  where bio and ssl is class objects where BIO is set like

  bio = BIO_new_socket(s,BIO_NOCLOSE)

  The increased memory does not occur before SSL_accept(ssl). The first time a 
client connect about a 100 kb is allocated, which I suppose is due to some 
initialising function. For each new client about 0-20 kb are still allocated 
after 

  SSL_shutdown(ssl);
  SSL_free(ssl);

  is issued. Is there some cleanup functions im forgetting?

  I am using windows btw.

Reply via email to