In message <[EMAIL PROTECTED]> on Wed, 23 Mar 2005 08:49:22 -0500, Chris Lalancette <[EMAIL PROTECTED]> said:
clalancette> Hello there, clalancette> I have a question about using OpenSSL that I haven't clalancette> been able to find an answer to on Google. I thought I clalancette> would ask here. Here is my simple program: clalancette> clalancette> #include <stdio.h> clalancette> #include <stdlib.h> clalancette> #include <openssl/bio.h> clalancette> #include <openssl/evp.h> clalancette> clalancette> int main() clalancette> { clalancette> BIO *mbio; clalancette> clalancette> mbio=BIO_new(BIO_s_mem()); clalancette> clalancette> BIO_free(mbio); clalancette> clalancette> return 0; clalancette> } No internal cleanup is performed. One of the following should help: CRYPTO_cleanup_all_ex_data(); ERR_remove_state(0); The "leak" is otherwise a false alarm. If you have increasing memory usage after a number of BIO_new()/BIO_free() pairs, then you can talk about a leak. clalancette> Three possibilities occur to me: clalancette> 1. I am misusing the OpenSSL library (this is the most clalancette> likely case). clalancette> 2. Valgrind is mis-reporting what is going on with clalancette> OpenSSL (although a good tool, I have found that clalancette> valgrind is not always correct). clalancette> 3. There actually is a memory leak in OpenSSL. I'd guess at 1. One could also say 3, but that would be a memory leak in your program rather than in OpenSSL :-). I suggest you take a quick look at the definition of app_shutdown() in apps.apps.h, it's a good pointer to what kind of cleanup is needed when you make use of all of the OpenSSL libraries. Cheers, Richard ----- Please consider sponsoring my work on free software. See http://www.free.lp.se/sponsoring.html for details. -- Richard Levitte [EMAIL PROTECTED] http://richard.levitte.org/ "When I became a man I put away childish things, including the fear of childishness and the desire to be very grown up." -- C.S. Lewis ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]