Merge #10027: Set to nullptr after delete

d93b97f Set to nullptr after delete (practicalswift)

Tree-SHA512: 7201cef4541557ffe31f52ce7527c4b08a2ff5aa1eae5268bdfee5b4843881f8fd115257bef6d1b4dfb71166951950a912ce87aef160ca89c2ca2ae264cfab1b

set dash pointers to nullptr after deletion
This commit is contained in:
Wladimir J. van der Laan 2017-03-20 08:39:13 +01:00 committed by Pasta
parent d563222854
commit de0919220b
No known key found for this signature in database
GPG Key ID: 0B8EB7A31A44D9C6
3 changed files with 5 additions and 0 deletions

View File

@ -482,6 +482,7 @@ void StopHTTPServer()
workQueue->WaitExit(); workQueue->WaitExit();
#endif #endif
delete workQueue; delete workQueue;
workQueue = nullptr;
} }
if (eventBase) { if (eventBase) {
LogPrint("http", "Waiting for HTTP event thread to exit\n"); LogPrint("http", "Waiting for HTTP event thread to exit\n");

View File

@ -160,11 +160,13 @@ void RPCNestedTests::rpcNestedTests()
pcoinsTip = nullptr; pcoinsTip = nullptr;
llmq::DestroyLLMQSystem(); llmq::DestroyLLMQSystem();
delete deterministicMNManager; delete deterministicMNManager;
deterministicMNManager = nullptr;
delete pcoinsdbview; delete pcoinsdbview;
pcoinsdbview = nullptr; pcoinsdbview = nullptr;
delete pblocktree; delete pblocktree;
pblocktree = nullptr; pblocktree = nullptr;
delete evoDb; delete evoDb;
evoDb = nullptr;
boost::filesystem::remove_all(boost::filesystem::path(path)); boost::filesystem::remove_all(boost::filesystem::path(path));
} }

View File

@ -141,6 +141,7 @@ BOOST_AUTO_TEST_CASE(existing_data_no_obfuscate)
// Call the destructor to free leveldb LOCK // Call the destructor to free leveldb LOCK
delete dbw; delete dbw;
dbw = nullptr;
// Now, set up another wrapper that wants to obfuscate the same directory // Now, set up another wrapper that wants to obfuscate the same directory
CDBWrapper odbw(ph, (1 << 10), false, false, true); CDBWrapper odbw(ph, (1 << 10), false, false, true);
@ -182,6 +183,7 @@ BOOST_AUTO_TEST_CASE(existing_data_reindex)
// Call the destructor to free leveldb LOCK // Call the destructor to free leveldb LOCK
delete dbw; delete dbw;
dbw = nullptr;
// Simulate a -reindex by wiping the existing data store // Simulate a -reindex by wiping the existing data store
CDBWrapper odbw(ph, (1 << 10), false, true, true); CDBWrapper odbw(ph, (1 << 10), false, true, true);