From: Dr. Matthias St. Pierre Date: Mon, 12 Feb 2018 01:37:27 +0000 (+0100) Subject: OPENSSL_cleanup: cleanup secure memory X-Git-Tag: OpenSSL_1_1_1-pre2~164 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=d7c402c4f2d9c311a91616fd75c24a15afabe2e5;ds=sidebyside OPENSSL_cleanup: cleanup secure memory If the global DRBGs are allocated on the secure heap, then calling CRYPTO_secure_malloc_done() inside main() will have no effect, unless OPENSSL_cleanup() has been called explicitely before that, because otherwise the DRBGs will still be allocated. So it is better to cleanup the secure heap automatically at the end of OPENSSL_cleanup(). Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/5294) --- diff --git a/crypto/init.c b/crypto/init.c index 1b94d07e04..4a88e9cc02 100644 --- a/crypto/init.c +++ b/crypto/init.c @@ -502,6 +502,8 @@ void OPENSSL_cleanup(void) obj_cleanup_int(); err_cleanup(); + CRYPTO_secure_malloc_done(); + base_inited = 0; }