[Bf-blender-cvs] [6ca6d29] master: Fix memleaks in our gtests.
Bastien Montagne
noreply at git.blender.org
Mon Dec 28 23:20:08 CET 2015
Commit: 6ca6d29e6b9a9f4f02ac48d8c77030f528ef4325
Author: Bastien Montagne
Date: Mon Dec 28 23:19:24 2015 +0100
Branches: master
https://developer.blender.org/rB6ca6d29e6b9a9f4f02ac48d8c77030f528ef4325
Fix memleaks in our gtests.
===================================================================
M source/blender/blenlib/intern/math_statistics.c
M tests/gtests/blenlib/BLI_polyfill2d_test.cc
M tests/gtests/blenlib/BLI_stack_test.cc
M tests/gtests/bmesh/bmesh_core_test.cc
===================================================================
diff --git a/source/blender/blenlib/intern/math_statistics.c b/source/blender/blenlib/intern/math_statistics.c
index bc7a801..784f690 100644
--- a/source/blender/blenlib/intern/math_statistics.c
+++ b/source/blender/blenlib/intern/math_statistics.c
@@ -105,8 +105,6 @@ void BLI_covariance_m_vn_ex(
const int n, const float *cos_vn, const int nbr_cos_vn, const float *center, const bool use_sample_correction,
float *r_covmat)
{
- int i, j, k;
-
/* Note about that division: see https://en.wikipedia.org/wiki/Bessel%27s_correction.
* In a nutshell, it must be 1 / (n - 1) for 'sample data', and 1 / n for 'population data'...
*/
@@ -123,7 +121,7 @@ void BLI_covariance_m_vn_ex(
BLI_task_parallel_range_ex(0, n * n, &data, NULL, 0, covariance_m_vn_ex_task_cb, 0, false);
}
else {
- for (k = 0; k < n * n; k++) {
+ for (int k = 0; k < n * n; k++) {
covariance_m_vn_ex_task_cb(&data, NULL, k);
}
}
diff --git a/tests/gtests/blenlib/BLI_polyfill2d_test.cc b/tests/gtests/blenlib/BLI_polyfill2d_test.cc
index 8ca19b1..a4ed70f 100644
--- a/tests/gtests/blenlib/BLI_polyfill2d_test.cc
+++ b/tests/gtests/blenlib/BLI_polyfill2d_test.cc
@@ -116,6 +116,7 @@ static void test_polyfill_topology(
EXPECT_EQ(true, ELEM((intptr_t)*p, 1, 2));
}
+ BLI_edgehashIterator_free(ehi);
BLI_edgehash_free(edgehash, NULL);
}
diff --git a/tests/gtests/blenlib/BLI_stack_test.cc b/tests/gtests/blenlib/BLI_stack_test.cc
index 44956a5..4c0b95f 100644
--- a/tests/gtests/blenlib/BLI_stack_test.cc
+++ b/tests/gtests/blenlib/BLI_stack_test.cc
@@ -116,6 +116,8 @@ TEST(stack, Peek)
}
EXPECT_EQ(BLI_stack_is_empty(stack), true);
+
+ BLI_stack_free(stack);
}
/* Check that clearing the stack leaves in it a correct state. */
diff --git a/tests/gtests/bmesh/bmesh_core_test.cc b/tests/gtests/bmesh/bmesh_core_test.cc
index 9c389a8..0cbb6ca 100644
--- a/tests/gtests/bmesh/bmesh_core_test.cc
+++ b/tests/gtests/bmesh/bmesh_core_test.cc
@@ -33,4 +33,5 @@ TEST(bmesh_core, BMVertCreate) {
EXPECT_FALSE(BM_elem_flag_test((BMElem *)bv3, BM_ELEM_SELECT));
EXPECT_EQ(1.5f, BM_elem_float_data_get(&bm->vdata, bv3, CD_PROP_FLT));
EXPECT_EQ(3, BM_mesh_elem_count(bm, BM_VERT));
+ BM_mesh_free(bm);
}
More information about the Bf-blender-cvs
mailing list