Fix crashed caused by using openssl from multiple threads simultanously.

Note that this doesn't make BigNumber class threadsafe - it never was that way.
This commit is contained in:
QAston
2013-08-18 17:43:24 +02:00
parent 2a3370929d
commit 19343ddd55
3 changed files with 95 additions and 0 deletions

View File

@@ -44,6 +44,7 @@
#include "RealmList.h"
#include "BigNumber.h"
#include "OpenSSLCrypto.h"
#ifdef _WIN32
#include "ServiceWin32.h"
@@ -121,6 +122,7 @@ public:
/// Main function
int Master::Run()
{
OpenSSLCrypto::threadsSetup();
BigNumber seed1;
seed1.SetRand(16 * 8);
@@ -368,6 +370,7 @@ int Master::Run()
// fixes a memory leak related to detaching threads from the module
//UnloadScriptingModule();
OpenSSLCrypto::threadsCleanup();
// Exit the process with specified return value
return World::GetExitCode();
}