Never mind, a little more experimentation answered my question. I was unloading the engine after calling CRYPTO_cleanup_all_ex_data, so the engine unload must leave some global ex stuff that is handled later.
.................................... Erik Tkal Juniper OAC/UAC/Pulse Development From: owner-openssl-...@openssl.org [mailto:owner-openssl-...@openssl.org] On Behalf Of Erik Tkal Sent: Wednesday, November 30, 2011 2:12 PM To: openssl-dev@openssl.org Subject: memory leak in engine cleanup I have an engine implementation that overrides some basic functionality (RAND, RSA, DSA). However, after calling ENGINE_Cleanup() I notice I have memory leak. The stack has ENGINE_Cleanup() calling up to the following: CRYPTO_free_ex_data(CRYPTO_EX_INDEX_ENGINE, e, &e->ex_data); which then ends up in the static int_free_ex_data function, which sets: item = def_get_class(class_index) where def_get_class returns the result of: OPENSSL_malloc(sizeof(EX_CLASS_ITEM)); However, in int_free_ex_data, "item" is never freed. I do not use ex_data in my engine, so is this a bug in OpenSSL, or is there something I need to do to make this behave properly? Thanks! .................................... Erik Tkal Juniper OAC/UAC/Pulse Development