eliminated possible memory leak

(cherry picked from commit e7e63fac6c)
This commit is contained in:
Ilya Lavrenov 2014-01-30 01:14:02 +04:00 committed by Alexander Smorkalov
parent 5f88e2b496
commit f6367a2ea5

View File

@ -2395,13 +2395,11 @@ TYPED_TEST_P(Core_CheckRange, Negative)
TypeParam data[] = {5, 10, 15, 4, 10, 2, 8, 12, 14}; TypeParam data[] = {5, 10, 15, 4, 10, 2, 8, 12, 14};
cv::Mat src = cv::Mat(3,3, cv::DataDepth<TypeParam>::value, data); cv::Mat src = cv::Mat(3,3, cv::DataDepth<TypeParam>::value, data);
cv::Point* bad_pt = new cv::Point(0, 0); cv::Point bad_pt(0, 0);
ASSERT_FALSE(checkRange(src, true, bad_pt, min_bound, max_bound)); ASSERT_FALSE(checkRange(src, true, &bad_pt, min_bound, max_bound));
ASSERT_EQ(bad_pt->x,0); ASSERT_EQ(bad_pt.x, 0);
ASSERT_EQ(bad_pt->y,1); ASSERT_EQ(bad_pt.y, 1);
delete bad_pt;
} }
TYPED_TEST_P(Core_CheckRange, Positive) TYPED_TEST_P(Core_CheckRange, Positive)
@ -2412,13 +2410,11 @@ TYPED_TEST_P(Core_CheckRange, Positive)
TypeParam data[] = {5, 10, 15, 4, 10, 2, 8, 12, 14}; TypeParam data[] = {5, 10, 15, 4, 10, 2, 8, 12, 14};
cv::Mat src = cv::Mat(3,3, cv::DataDepth<TypeParam>::value, data); cv::Mat src = cv::Mat(3,3, cv::DataDepth<TypeParam>::value, data);
cv::Point* bad_pt = new cv::Point(0, 0); cv::Point bad_pt(0, 0);
ASSERT_TRUE(checkRange(src, true, bad_pt, min_bound, max_bound)); ASSERT_TRUE(checkRange(src, true, &bad_pt, min_bound, max_bound));
ASSERT_EQ(bad_pt->x,0); ASSERT_EQ(bad_pt.x, 0);
ASSERT_EQ(bad_pt->y,0); ASSERT_EQ(bad_pt.y, 0);
delete bad_pt;
} }
TYPED_TEST_P(Core_CheckRange, Bounds) TYPED_TEST_P(Core_CheckRange, Bounds)
@ -2429,13 +2425,11 @@ TYPED_TEST_P(Core_CheckRange, Bounds)
TypeParam data[] = {5, 10, 15, 4, 10, 2, 8, 12, 14}; TypeParam data[] = {5, 10, 15, 4, 10, 2, 8, 12, 14};
cv::Mat src = cv::Mat(3,3, cv::DataDepth<TypeParam>::value, data); cv::Mat src = cv::Mat(3,3, cv::DataDepth<TypeParam>::value, data);
cv::Point* bad_pt = new cv::Point(0, 0); cv::Point bad_pt(0, 0);
ASSERT_FALSE(checkRange(src, true, bad_pt, min_bound, max_bound)); ASSERT_FALSE(checkRange(src, true, &bad_pt, min_bound, max_bound));
ASSERT_EQ(bad_pt->x,0); ASSERT_EQ(bad_pt.x, 0);
ASSERT_EQ(bad_pt->y,0); ASSERT_EQ(bad_pt.y, 0);
delete bad_pt;
} }
TYPED_TEST_P(Core_CheckRange, Zero) TYPED_TEST_P(Core_CheckRange, Zero)