Skip to content

Commit

Permalink
Prevent accessing of global c++ objects once they are deleted
Browse files Browse the repository at this point in the history
Fixes (Maybe) opendnssec#729
  • Loading branch information
nhorman committed Oct 27, 2023
1 parent f4661af commit f45b02c
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/lib/SoftHSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@

// Initialise the one-and-only instance

int objects_deleted = 0;

#ifdef HAVE_CXX11

std::unique_ptr<MutexFactory> MutexFactory::instance(nullptr);
Expand Down Expand Up @@ -429,6 +431,7 @@ SoftHSM::SoftHSM()
// Destructor
SoftHSM::~SoftHSM()
{

if (handleManager != NULL) delete handleManager;
handleManager = NULL;
if (sessionManager != NULL) delete sessionManager;
Expand All @@ -445,6 +448,7 @@ SoftHSM::~SoftHSM()

isInitialised = false;

objects_deleted = 1;
resetMutexFactoryCallbacks();
}

Expand Down
Loading

0 comments on commit f45b02c

Please sign in to comment.