Skip to content

Commit 941febc

Browse files
committed
use Base Alloc in tests to fix Proxy Lib scenarios
1 parent e53e52f commit 941febc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/memoryPoolAPI.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ TEST_F(test, getLastFailedMemoryProvider) {
284284

285285
umf_result_t alloc(size_t size, size_t, void **ptr) noexcept {
286286
if (allocResult == UMF_RESULT_SUCCESS) {
287-
*ptr = malloc(size);
287+
*ptr = umf_ba_global_alloc(size);
288288
} else {
289289
*ptr = nullptr;
290290
}
@@ -293,7 +293,7 @@ TEST_F(test, getLastFailedMemoryProvider) {
293293
}
294294

295295
umf_result_t free(void *ptr, [[maybe_unused]] size_t size) noexcept {
296-
::free(ptr);
296+
umf_ba_global_free(ptr);
297297
return UMF_RESULT_SUCCESS;
298298
}
299299

test/pools/disjoint_pool.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ TEST_F(test, freeErrorPropagation) {
5757
static umf_result_t expectedResult = UMF_RESULT_SUCCESS;
5858
struct memory_provider : public umf_test::provider_base_t {
5959
umf_result_t alloc(size_t size, size_t, void **ptr) noexcept {
60-
*ptr = malloc(size);
60+
*ptr = umf_ba_global_alloc(size);
6161
return UMF_RESULT_SUCCESS;
6262
}
6363

6464
umf_result_t free(void *ptr, [[maybe_unused]] size_t size) noexcept {
6565
// do the actual free only when we expect the success
6666
if (expectedResult == UMF_RESULT_SUCCESS) {
67-
::free(ptr);
67+
umf_ba_global_free(ptr);
6868
}
6969
return expectedResult;
7070
}
@@ -110,12 +110,12 @@ TEST_F(test, sharedLimits) {
110110

111111
struct memory_provider : public umf_test::provider_base_t {
112112
umf_result_t alloc(size_t size, size_t, void **ptr) noexcept {
113-
*ptr = malloc(size);
113+
*ptr = umf_ba_global_alloc(size);
114114
numAllocs++;
115115
return UMF_RESULT_SUCCESS;
116116
}
117117
umf_result_t free(void *ptr, [[maybe_unused]] size_t size) noexcept {
118-
::free(ptr);
118+
umf_ba_global_free(ptr);
119119
numFrees++;
120120
return UMF_RESULT_SUCCESS;
121121
}

0 commit comments

Comments
 (0)