Fix some memory leaks in the tests
This commit is contained in:
@@ -269,6 +269,8 @@ void Base64TestCase::EncodeDecodeRandom()
|
|||||||
size_t realsize = size;
|
size_t realsize = size;
|
||||||
CPPUNIT_ASSERT(wxBase64Decode(buff2, realsize, (char *)buff, size));
|
CPPUNIT_ASSERT(wxBase64Decode(buff2, realsize, (char *)buff, size));
|
||||||
CPPUNIT_ASSERT(wxBase64Encode(buff2, size, buff2, realsize));
|
CPPUNIT_ASSERT(wxBase64Encode(buff2, size, buff2, realsize));
|
||||||
|
delete[] buff2;
|
||||||
|
delete[] buff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Base64TestCase::DecodeInvalid()
|
void Base64TestCase::DecodeInvalid()
|
||||||
|
@@ -402,6 +402,7 @@ public:
|
|||||||
1, m_events.size()
|
1, m_events.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
delete e;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void GenerateEvent() = 0;
|
virtual void GenerateEvent() = 0;
|
||||||
|
@@ -1230,6 +1230,7 @@ void ClippingBoxTestCaseDCBase::OneDevRegionNonRect()
|
|||||||
m_dc->DeviceToLogicalXRel(clipW),
|
m_dc->DeviceToLogicalXRel(clipW),
|
||||||
m_dc->DeviceToLogicalYRel(clipH), 1);
|
m_dc->DeviceToLogicalYRel(clipH), 1);
|
||||||
CheckClipShape(bmpRef, 1);
|
CheckClipShape(bmpRef, 1);
|
||||||
|
delete memDC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClippingBoxTestCaseDCBase::OneDevRegionAndReset()
|
void ClippingBoxTestCaseDCBase::OneDevRegionAndReset()
|
||||||
|
@@ -183,6 +183,7 @@ void MeasuringTextTestCase::GraphicsGetTextExtent()
|
|||||||
context->SetFont(font, *wxBLACK);
|
context->SetFont(font, *wxBLACK);
|
||||||
double width, height, descent, externalLeading = 0.0;
|
double width, height, descent, externalLeading = 0.0;
|
||||||
context->GetTextExtent("x", &width, &height, &descent, &externalLeading);
|
context->GetTextExtent("x", &width, &height, &descent, &externalLeading);
|
||||||
|
delete context;
|
||||||
|
|
||||||
// TODO: Determine a way to make these tests more robust.
|
// TODO: Determine a way to make these tests more robust.
|
||||||
CPPUNIT_ASSERT(width > 0.0);
|
CPPUNIT_ASSERT(width > 0.0);
|
||||||
|
@@ -146,6 +146,7 @@ void AtomicTestCase::TestWithThreads(int count, ETestType testType)
|
|||||||
if ( thread->Create() != wxTHREAD_NO_ERROR )
|
if ( thread->Create() != wxTHREAD_NO_ERROR )
|
||||||
{
|
{
|
||||||
wxLogError(wxT("Can't create thread!"));
|
wxLogError(wxT("Can't create thread!"));
|
||||||
|
delete thread;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
threads.Add(thread);
|
threads.Add(thread);
|
||||||
@@ -161,6 +162,7 @@ void AtomicTestCase::TestWithThreads(int count, ETestType testType)
|
|||||||
{
|
{
|
||||||
// each thread should return 0, else it detected some problem
|
// each thread should return 0, else it detected some problem
|
||||||
CPPUNIT_ASSERT (threads[i]->Wait() == (wxThread::ExitCode)0);
|
CPPUNIT_ASSERT (threads[i]->Wait() == (wxThread::ExitCode)0);
|
||||||
|
delete threads[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPUNIT_ASSERT( int1 == 0 );
|
CPPUNIT_ASSERT( int1 == 0 );
|
||||||
|
@@ -130,6 +130,7 @@ void QueueTestCase::TestReceive()
|
|||||||
// if it returns a negative, then it detected some problem.
|
// if it returns a negative, then it detected some problem.
|
||||||
wxThread::ExitCode code = threads[i]->Wait();
|
wxThread::ExitCode code = threads[i]->Wait();
|
||||||
CPPUNIT_ASSERT_EQUAL( code, (wxThread::ExitCode)wxMSGQUEUE_NO_ERROR );
|
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( code1, (wxThread::ExitCode)wxMSGQUEUE_NO_ERROR );
|
||||||
CPPUNIT_ASSERT_EQUAL( code2, (wxThread::ExitCode)wxMSGQUEUE_TIMEOUT );
|
CPPUNIT_ASSERT_EQUAL( code2, (wxThread::ExitCode)wxMSGQUEUE_TIMEOUT );
|
||||||
|
delete thread2;
|
||||||
|
delete thread1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// every thread tries to read exactly m_maxMsgCount messages from its queue
|
// every thread tries to read exactly m_maxMsgCount messages from its queue
|
||||||
|
Reference in New Issue
Block a user