Fix some memory leaks in the tests

This commit is contained in:
Paul Cornett
2017-10-01 09:41:49 -07:00
parent 8c353236ac
commit fc7f20c419
6 changed files with 10 additions and 0 deletions

View File

@@ -146,6 +146,7 @@ void AtomicTestCase::TestWithThreads(int count, ETestType testType)
if ( thread->Create() != wxTHREAD_NO_ERROR )
{
wxLogError(wxT("Can't create thread!"));
delete thread;
}
else
threads.Add(thread);
@@ -161,6 +162,7 @@ void AtomicTestCase::TestWithThreads(int count, ETestType testType)
{
// each thread should return 0, else it detected some problem
CPPUNIT_ASSERT (threads[i]->Wait() == (wxThread::ExitCode)0);
delete threads[i];
}
CPPUNIT_ASSERT( int1 == 0 );

View File

@@ -130,6 +130,7 @@ void QueueTestCase::TestReceive()
// if it returns a negative, then it detected some problem.
wxThread::ExitCode code = threads[i]->Wait();
CPPUNIT_ASSERT_EQUAL( code, (wxThread::ExitCode)wxMSGQUEUE_NO_ERROR );
delete threads[i];
}
}
@@ -162,6 +163,8 @@ void QueueTestCase::TestReceiveTimeout()
CPPUNIT_ASSERT_EQUAL( code1, (wxThread::ExitCode)wxMSGQUEUE_NO_ERROR );
CPPUNIT_ASSERT_EQUAL( code2, (wxThread::ExitCode)wxMSGQUEUE_TIMEOUT );
delete thread2;
delete thread1;
}
// every thread tries to read exactly m_maxMsgCount messages from its queue