Fix some memory leaks in the tests
This commit is contained in:
		@@ -269,6 +269,8 @@ void Base64TestCase::EncodeDecodeRandom()
 | 
			
		||||
    size_t realsize = size;
 | 
			
		||||
    CPPUNIT_ASSERT(wxBase64Decode(buff2, realsize, (char *)buff, size));
 | 
			
		||||
    CPPUNIT_ASSERT(wxBase64Encode(buff2, size, buff2, realsize));
 | 
			
		||||
    delete[] buff2;
 | 
			
		||||
    delete[] buff;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Base64TestCase::DecodeInvalid()
 | 
			
		||||
 
 | 
			
		||||
@@ -402,6 +402,7 @@ public:
 | 
			
		||||
            1, m_events.size()
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        delete e;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    virtual void GenerateEvent() = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -1230,6 +1230,7 @@ void ClippingBoxTestCaseDCBase::OneDevRegionNonRect()
 | 
			
		||||
                 m_dc->DeviceToLogicalXRel(clipW),
 | 
			
		||||
                 m_dc->DeviceToLogicalYRel(clipH), 1);
 | 
			
		||||
    CheckClipShape(bmpRef, 1);
 | 
			
		||||
    delete memDC;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ClippingBoxTestCaseDCBase::OneDevRegionAndReset()
 | 
			
		||||
 
 | 
			
		||||
@@ -183,6 +183,7 @@ void MeasuringTextTestCase::GraphicsGetTextExtent()
 | 
			
		||||
    context->SetFont(font, *wxBLACK);
 | 
			
		||||
    double width, height, descent, externalLeading = 0.0;
 | 
			
		||||
    context->GetTextExtent("x", &width, &height, &descent, &externalLeading);
 | 
			
		||||
    delete context;
 | 
			
		||||
 | 
			
		||||
    // TODO: Determine a way to make these tests more robust.
 | 
			
		||||
    CPPUNIT_ASSERT(width > 0.0);
 | 
			
		||||
 
 | 
			
		||||
@@ -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 );
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user