Commit 773fd0ba authored by Matt Caswell's avatar Matt Caswell
Browse files

Call CONF_modules_free() before ENGINE_cleanup() in auto-deinit



During auto de-init we were calling ENGINE_cleanup(), and then later
CONF_modules_free(). However the latter function can end up calling
engine code, which can lead to a use of the global_engine_lock after it
has already been freed. Therefore we should swap the calling order of
these two functions.

Reviewed-by: default avatarRich Salz <rsalz@openssl.org>
parent 71627423
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -468,13 +468,13 @@ void OPENSSL_cleanup(void)
    fprintf(stderr, "OPENSSL_INIT: OPENSSL_INIT_library_stop: "
                    "RAND_cleanup()\n");

#endif
#ifndef OPENSSL_NO_ENGINE
    ENGINE_cleanup();
#endif
    CRYPTO_cleanup_all_ex_data();
    EVP_cleanup();
    CONF_modules_free();
#ifndef OPENSSL_NO_ENGINE
    ENGINE_cleanup();
#endif
    RAND_cleanup();
    base_inited = 0;
}