Merge pull request #5203 from ilya-lavrenov:valgrind_error

pull/5218/head
Alexander Alekhin 9 years ago
commit 3172e6d54b
  1. 20
      modules/core/test/test_ds.cpp
  2. 10
      modules/features2d/test/test_nearestneighbors.cpp
  3. 20
      modules/imgproc/test/test_cvtyuv.cpp
  4. 2
      modules/imgproc/test/test_floodfill.cpp
  5. 3
      modules/imgproc/test/test_imgwarp.cpp
  6. 2
      modules/ts/src/ts.cpp

@ -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 );
} }

@ -65,13 +65,13 @@ protected:
virtual void run( int start_from ); virtual void run( int start_from );
virtual void createModel( const Mat& data ) = 0; virtual void createModel( const Mat& data ) = 0;
virtual int findNeighbors( Mat& points, Mat& neighbors ) = 0; virtual int findNeighbors( Mat& points, Mat& neighbors ) = 0;
virtual int checkGetPoins( const Mat& data ); virtual int checkGetPoints( const Mat& data );
virtual int checkFindBoxed(); virtual int checkFindBoxed();
virtual int checkFind( const Mat& data ); virtual int checkFind( const Mat& data );
virtual void releaseModel() = 0; virtual void releaseModel() = 0;
}; };
int NearestNeighborTest::checkGetPoins( const Mat& ) int NearestNeighborTest::checkGetPoints( const Mat& )
{ {
return cvtest::TS::OK; return cvtest::TS::OK;
} }
@ -129,7 +129,7 @@ void NearestNeighborTest::run( int /*start_from*/ ) {
createModel( desc ); createModel( desc );
tempCode = checkGetPoins( desc ); tempCode = checkGetPoints( desc );
if( tempCode != cvtest::TS::OK ) if( tempCode != cvtest::TS::OK )
{ {
ts->printf( cvtest::TS::LOG, "bad accuracy of GetPoints \n" ); ts->printf( cvtest::TS::LOG, "bad accuracy of GetPoints \n" );
@ -162,7 +162,7 @@ public:
CV_KDTreeTest_CPP() {} CV_KDTreeTest_CPP() {}
protected: protected:
virtual void createModel( const Mat& data ); virtual void createModel( const Mat& data );
virtual int checkGetPoins( const Mat& data ); virtual int checkGetPoints( const Mat& data );
virtual int findNeighbors( Mat& points, Mat& neighbors ); virtual int findNeighbors( Mat& points, Mat& neighbors );
virtual int checkFindBoxed(); virtual int checkFindBoxed();
virtual void releaseModel(); virtual void releaseModel();
@ -175,7 +175,7 @@ void CV_KDTreeTest_CPP::createModel( const Mat& data )
tr = new KDTree( data, false ); tr = new KDTree( data, false );
} }
int CV_KDTreeTest_CPP::checkGetPoins( const Mat& data ) int CV_KDTreeTest_CPP::checkGetPoints( const Mat& data )
{ {
Mat res1( data.size(), data.type() ), Mat res1( data.size(), data.type() ),
res3( data.size(), data.type() ); res3( data.size(), data.type() );

@ -548,7 +548,7 @@ void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter*
struct ConversionYUV struct ConversionYUV
{ {
ConversionYUV( const int code ) explicit ConversionYUV( const int code )
{ {
yuvReader_ = YUVreader :: getReader(code); yuvReader_ = YUVreader :: getReader(code);
yuvWriter_ = YUVwriter :: getWriter(code); yuvWriter_ = YUVwriter :: getWriter(code);
@ -557,6 +557,24 @@ struct ConversionYUV
grayWriter_ = GRAYwriter:: getWriter(code); grayWriter_ = GRAYwriter:: getWriter(code);
} }
~ConversionYUV()
{
if (yuvReader_)
delete yuvReader_;
if (yuvWriter_)
delete yuvWriter_;
if (rgbReader_)
delete rgbReader_;
if (rgbWriter_)
delete rgbWriter_;
if (grayWriter_)
delete grayWriter_;
}
int getDcn() int getDcn()
{ {
return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels()); return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());

@ -501,6 +501,8 @@ _exit_:
comp[6] = s1; comp[6] = s1;
comp[7] = s2; comp[7] = s2;
comp[8] = 0; comp[8] = 0;
cvReleaseMemStorage(&st);
} }

@ -1426,6 +1426,9 @@ TEST(Imgproc_cvWarpAffine, regression)
int h = src->height; int h = src->height;
cv2DRotationMatrix(cvPoint2D32f(w*0.5f, h*0.5f), 45.0, 1.0, &M); cv2DRotationMatrix(cvPoint2D32f(w*0.5f, h*0.5f), 45.0, 1.0, &M);
cvWarpAffine(src, dst, &M); cvWarpAffine(src, dst, &M);
cvReleaseImage(&src);
cvReleaseImage(&dst);
} }
TEST(Imgproc_fitLine_vector_3d, regression) TEST(Imgproc_fitLine_vector_3d, regression)

@ -323,6 +323,7 @@ BadArgTest::BadArgTest()
progress = -1; progress = -1;
test_case_idx = -1; test_case_idx = -1;
freq = cv::getTickFrequency(); freq = cv::getTickFrequency();
t = -1;
// oldErrorCbk = 0; // oldErrorCbk = 0;
// oldErrorCbkData = 0; // oldErrorCbkData = 0;
} }
@ -338,6 +339,7 @@ int BadArgTest::run_test_case( int expected_code, const string& _descr )
{ {
test_case_idx = 0; test_case_idx = 0;
progress = 0; progress = 0;
t = 0;
dt = 0; dt = 0;
} }
else else

Loading…
Cancel
Save