fixed memory leak in core ds tests

This commit is contained in:
Ilya Lavrenov 2015-08-15 00:35:38 +03:00
parent 8d264d9f64
commit 7719da9552

View File

@ -493,6 +493,7 @@ class Core_SeqBaseTest : public Core_DynStructBaseTest
{ {
public: public:
Core_SeqBaseTest(); Core_SeqBaseTest();
virtual ~Core_SeqBaseTest();
void clear(); void clear();
void run( int ); void run( int );
@ -503,11 +504,14 @@ protected:
int test_seq_ops( int iters ); int test_seq_ops( int iters );
}; };
Core_SeqBaseTest::Core_SeqBaseTest() Core_SeqBaseTest::Core_SeqBaseTest()
{ {
} }
Core_SeqBaseTest::~Core_SeqBaseTest()
{
clear();
}
void Core_SeqBaseTest::clear() void Core_SeqBaseTest::clear()
{ {
@ -1208,6 +1212,7 @@ class Core_SetTest : public Core_DynStructBaseTest
{ {
public: public:
Core_SetTest(); Core_SetTest();
virtual ~Core_SetTest();
void clear(); void clear();
void run( int ); void run( int );
@ -1221,6 +1226,10 @@ Core_SetTest::Core_SetTest()
{ {
} }
Core_SetTest::~Core_SetTest()
{
clear();
}
void Core_SetTest::clear() void Core_SetTest::clear()
{ {
@ -1419,6 +1428,7 @@ class Core_GraphTest : public Core_DynStructBaseTest
{ {
public: public:
Core_GraphTest(); Core_GraphTest();
virtual ~Core_GraphTest();
void clear(); void clear();
void run( int ); void run( int );
@ -1432,6 +1442,10 @@ Core_GraphTest::Core_GraphTest()
{ {
} }
Core_GraphTest::~Core_GraphTest()
{
clear();
}
void Core_GraphTest::clear() void Core_GraphTest::clear()
{ {
@ -2044,6 +2058,8 @@ void Core_GraphScanTest::run( int )
CV_TS_SEQ_CHECK_CONDITION( vtx_count == 0 && edge_count == 0, CV_TS_SEQ_CHECK_CONDITION( vtx_count == 0 && edge_count == 0,
"Not every vertex/edge has been visited" ); "Not every vertex/edge has been visited" );
update_progressbar(); update_progressbar();
cvReleaseGraphScanner( &scanner );
} }
// for a random graph the test just checks that every graph vertex and // for a random graph the test just checks that every graph vertex and
@ -2108,8 +2124,6 @@ void Core_GraphScanTest::run( int )
catch(int) catch(int)
{ {
} }
cvReleaseGraphScanner( &scanner );
} }