aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-07-27 21:00:19 +0000
committerlloyd <[email protected]>2010-07-27 21:00:19 +0000
commitf8d7c088f054345a9cfb5eaf09ac60e21edddb22 (patch)
treecadef3cd90409bf3ea1f6bd33b0dad6fa7e485eb
parent2f3414c1bb2af4db4b03282b47decddf4f3e27e9 (diff)
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.
-rw-r--r--src/algo_factory/algo_factory.cpp4
1 files changed, 2 insertions, 2 deletions
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<Engine>());
-
delete block_cipher_cache;
delete stream_cipher_cache;
delete hash_cache;
delete mac_cache;
+
+ std::for_each(engines.begin(), engines.end(), del_fun<Engine>());
}
void Algorithm_Factory::add_engine(Engine* engine)