From ea42bd40595faefb19e2ec8d7a9efad4f75cff80 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 5 Sep 2016 14:12:58 +0100 Subject: Fix mem leaks during auto-deinit Certain functions are automatically called during auto-deinit in order to deallocate resources. However, if we have never entered a function which marks lib crypto as inited then they never get called. This can happen if the user only ever makes use of a small sub-set of functions that don't hit the auto-init code. This commit ensures all such resources deallocated by these functions also init libcrypto when they are initially allocated. Reviewed-by: Richard Levitte Reviewed-by: Ben Laurie (cherry picked from commit 135648bcd0e9db029582d3d7627a90a1b566c5d6) --- crypto/engine/eng_lib.c | 1 + 1 file changed, 1 insertion(+) (limited to 'crypto/engine') diff --git a/crypto/engine/eng_lib.c b/crypto/engine/eng_lib.c index 67d755a2aa..28de21d73d 100644 --- a/crypto/engine/eng_lib.c +++ b/crypto/engine/eng_lib.c @@ -18,6 +18,7 @@ CRYPTO_ONCE engine_lock_init = CRYPTO_ONCE_STATIC_INIT; DEFINE_RUN_ONCE(do_engine_lock_init) { + OPENSSL_init_crypto(0, NULL); global_engine_lock = CRYPTO_THREAD_lock_new(); return global_engine_lock != NULL; } -- cgit v1.2.3