[openssl-users] How do I uninitialize OpenSSL properly?

Alexander newcomer83 at web.de
Tue Apr 28 17:49:51 UTC 2015

Unfortunately this didn't solve my problem, but at least I narrowed it
down. The leaks are caused by my call to
"SSL_CTX_load_verify_locations", which is essentially

I found that function in x509_d2.c and I find it suspicious that this
function invokes exactly 4 function calls and leads to 4 memory leaks.
Therefore I assume that I need to undo all of these function calls when
exiting, which are:
- 2x X509_STORE_add_lookup
- 1x X509_LOOKUP_load_file
- 1x X509_LOOKUP_add_dir

How can I clean up everything those 4 functions allocate?


Am 26.04.2015 um 20:14 schrieb Alexander:
> Thanks for the quick reply! I'm sorry, I didn't mean to sound impatient.
> It's just that I read through the archives and so much has been
> happening that I was afraid that my thread would be swamped away unnoticed.
> My problem is most likely an on process exit thing, because I do the
> certificate stuff only once, no matter how long the application is
> running. Therefore it's probably not a big problem, but memory leaks
> look bad, because they imply that I am using OpenSSL improperly.
> Anyway, thanks for the advice on apps_startup and apps_shutdown. I will
> try them out as soon as I can. Those defines do look like salvation from
> all the problems I had finding the right methods to
> initialize/uninitialize OpenSSL properly.
> Have a happy rest of Sunday!
> Cheers
> Alex
> Am 26.04.2015 um 18:33 schrieb Salz, Rich:
>> This isn't paid support; two days isn't a long time to wait :)
>> Is this on process exit?  If so, does it really matter?
>> You might look at the apps_startup and apps_shutdown functions in apps/openssl.c on the master branch.
>> 	/r$
>> --  
>> Senior Architect, Akamai Technologies
>> IM: richsalz at jabber.at Twitter: RichSalz
>> _______________________________________________
>> openssl-users mailing list
>> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
> _______________________________________________
> openssl-users mailing list
> To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

More information about the openssl-users mailing list