fixed memory leaks in cvtyuv tests
This commit is contained in:
parent
7719da9552
commit
b2489d31d6
@ -548,7 +548,7 @@ void referenceRGB2YUV(const Mat& rgb, Mat& yuv, RGBreader* rgbReader, YUVwriter*
|
||||
|
||||
struct ConversionYUV
|
||||
{
|
||||
ConversionYUV( const int code )
|
||||
explicit ConversionYUV( const int code )
|
||||
{
|
||||
yuvReader_ = YUVreader :: getReader(code);
|
||||
yuvWriter_ = YUVwriter :: getWriter(code);
|
||||
@ -557,6 +557,24 @@ struct ConversionYUV
|
||||
grayWriter_ = GRAYwriter:: getWriter(code);
|
||||
}
|
||||
|
||||
~ConversionYUV()
|
||||
{
|
||||
if (yuvReader_)
|
||||
delete yuvReader_;
|
||||
|
||||
if (yuvWriter_)
|
||||
delete yuvWriter_;
|
||||
|
||||
if (rgbReader_)
|
||||
delete rgbReader_;
|
||||
|
||||
if (rgbReader_)
|
||||
delete rgbReader_;
|
||||
|
||||
if (grayWriter_)
|
||||
delete grayWriter_;
|
||||
}
|
||||
|
||||
int getDcn()
|
||||
{
|
||||
return (rgbWriter_ != 0) ? rgbWriter_->channels() : ((grayWriter_ != 0) ? grayWriter_->channels() : yuvWriter_->channels());
|
||||
|
Loading…
Reference in New Issue
Block a user