Skip to content

Commit 6c5ec8d

Browse files
nhormanEmantor
authored andcommitted
Prevent accessing of global c++ objects once they are deleted
Fixes (Maybe) #729. Reset objects_deleted after reset is called.
1 parent 913e7bf commit 6c5ec8d

File tree

2 files changed

+143
-0
lines changed

2 files changed

+143
-0
lines changed

src/lib/SoftHSM.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989

9090
// Initialise the one-and-only instance
9191

92+
int objects_deleted = 0;
93+
9294
#ifdef HAVE_CXX11
9395

9496
std::unique_ptr<MutexFactory> MutexFactory::instance(nullptr);
@@ -406,6 +408,8 @@ void SoftHSM::reset()
406408
{
407409
if (instance.get())
408410
instance.reset();
411+
412+
objects_deleted = 0;
409413
}
410414

411415
// Constructor
@@ -445,6 +449,7 @@ SoftHSM::~SoftHSM()
445449

446450
isInitialised = false;
447451

452+
objects_deleted = 1;
448453
resetMutexFactoryCallbacks();
449454
}
450455

0 commit comments

Comments
 (0)