From f8d7c088f054345a9cfb5eaf09ac60e21edddb22 Mon Sep 17 00:00:00 2001 From: lloyd Date: Tue, 27 Jul 2010 21:00:19 +0000 Subject: In Algorithm_Factory, delete the Engines after deleting the caches rather than before. Otherwise, we run into a problem with dynamically loaded engines: the engine will be deleted (and thus, the external library unloaded), before calling the destructors on any objects which may have been cached, so we jump to a now invalid address instead of the destructor code. --- src/algo_factory/algo_factory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/algo_factory') diff --git a/src/algo_factory/algo_factory.cpp b/src/algo_factory/algo_factory.cpp index 13e81e7f5..526ad1beb 100644 --- a/src/algo_factory/algo_factory.cpp +++ b/src/algo_factory/algo_factory.cpp @@ -100,12 +100,12 @@ Algorithm_Factory::Algorithm_Factory(Mutex_Factory& mf) */ Algorithm_Factory::~Algorithm_Factory() { - std::for_each(engines.begin(), engines.end(), del_fun()); - delete block_cipher_cache; delete stream_cipher_cache; delete hash_cache; delete mac_cache; + + std::for_each(engines.begin(), engines.end(), del_fun()); } void Algorithm_Factory::add_engine(Engine* engine) -- cgit v1.2.3