Hi,
I have an application that creates a bunch of SSL connections during its life. For each of these connections, I have to store "application data" in an SSL object (in my case this is SSL_client object). The trouble is that the memory allocated in the SSL_get_ex_new_index is never freed until the end of the application. I am tracking this through valgrind and can create a simple test case if that would help, but I think my problem is simply misusing the API. My question is how can I use SSL_get_ex_new_index such that I can free memory once the SSL connection closes? Should I be re-using the index returned instead of calling the function multiple times - after all I have a new SSL_client object each time? I have tried setting the function pointers in the SSL_get_ex_new_index, but for some reason the callbacks are never called. Moreover the memory leaked is not an allocation that I have made and thus am unable to free it even if they were called. I have made sure that I am calling all the SSL freeing routines .. SSL_close, SSL_free etc. Any help will be greatly appreciated. I have read the following man pages to no avail: http://www.openssl.org/docs/ssl/SSL_get_ex_new_index.html http://www.openssl.org/docs/crypto/RSA_get_ex_new_index.html http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html The example in the man page SSL_CTX_set_verify is more or less what I am trying to do. Thanks for taking the time to read through and looking forward for some tips. Regards, Amit Sharma