testing: fix cppcheck ClientTest::registerTests() warning
cppcheck warns that "factory" might get overwritten. Probably never happened becaued registerTests() is only called once, but let's fix it anyway.
This commit is contained in:
parent
16db5644c6
commit
764e9eee79
|
@ -6654,6 +6654,7 @@ private:
|
|||
|
||||
void ClientTest::registerTests()
|
||||
{
|
||||
freeFactory();
|
||||
factory = (void *)new ClientTestFactory(*this);
|
||||
CppUnit::TestFactoryRegistry::getRegistry().registerFactory((CppUnit::TestFactory *)factory);
|
||||
}
|
||||
|
@ -6665,15 +6666,20 @@ ClientTest::ClientTest(int serverSleepSec, const std::string &serverLog) :
|
|||
{
|
||||
}
|
||||
|
||||
ClientTest::~ClientTest()
|
||||
void ClientTest::freeFactory()
|
||||
{
|
||||
if(factory) {
|
||||
CppUnit::TestFactoryRegistry::getRegistry().unregisterFactory((CppUnit::TestFactory *)factory);
|
||||
delete (CppUnit::TestFactory *)factory;
|
||||
factory = 0;
|
||||
factory = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
ClientTest::~ClientTest()
|
||||
{
|
||||
freeFactory();
|
||||
}
|
||||
|
||||
void ClientTest::registerCleanup(Cleanup_t cleanup)
|
||||
{
|
||||
cleanupSet.insert(cleanup);
|
||||
|
|
|
@ -435,6 +435,7 @@ class ClientTest : private boost::noncopyable {
|
|||
* registerTests() and remains valid until the client is deleted
|
||||
*/
|
||||
void *factory;
|
||||
void freeFactory();
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue