Skip to content

Commit 347b14b

Browse files
committed
Fix: do not allocate too much memory in calloc_compliance_test()
Signed-off-by: Lukasz Dorau <lukasz.dorau@intel.com>
1 parent a8096ca commit 347b14b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

test/malloc_compliance_tests.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ void calloc_compliance_test(umf_memory_pool_handle_t hPool) {
8585
// Checking that the memory returned by calloc is zero filled
8686
for (int i = 0; i < ITERATIONS; i++) {
8787
alloc_size = rand_alloc_size(MAX_ALLOC_SIZE);
88-
alloc_ptr[i] = umfPoolCalloc(hPool, i + 1, alloc_size);
88+
alloc_ptr[i] = umfPoolCalloc(hPool, 2, alloc_size);
8989

9090
ASSERT_NE(alloc_ptr[i], nullptr)
9191
<< "calloc returned NULL, couldn't allocate much memory";
92-
ASSERT_NE(bufferIsFilledWithChar(alloc_ptr[i], alloc_size * (i + 1), 0),
93-
0)
92+
ASSERT_NE(bufferIsFilledWithChar(alloc_ptr[i], 2 * alloc_size, 0), 0)
9493
<< "Memory returned by calloc was not zeroed";
9594
}
9695
free_memory(hPool, alloc_ptr);

0 commit comments

Comments
 (0)