我有一个功能,我做了一个mat操作。
void my_func()
{
vector<Point> my_vect=another_func();
Mat my_array((int)my_vect.size(),1,CV_8UC1); //This line is reported as leakage
for(int i=0;i<my_vect.size();i++)
my_array.at<uchar>(i,1)=Other_image.at<uchar>(my_vect[i]);
}
答案 0 :(得分:1)
不知道泄漏,但也至少有一个缓冲区溢出。
Mat my_array( 17, 1, CV_8UC1 ); // 17 rows, 1 col
for(int i=0; i<17; i++)
// should be (i,0) below, (i,1) is already out of bounds
my_array.at<uchar>(i,1) = Other_image.at<uchar>(my_vect[i]); // <-- this looks broken, too