Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/memory_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
}

umf_result_t umfPoolDestroy(umf_memory_pool_handle_t hPool) {
if (hPool == NULL) {
LOG_ERR("memory pool handle is NULL");
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

if (umf_ba_global_is_destroyed()) {
return UMF_RESULT_ERROR_UNKNOWN;
}
Expand Down
5 changes: 5 additions & 0 deletions test/poolFixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfMemTest);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfPoolTest);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(umfMultiPoolTest);

TEST_P(umfPoolTest, destroyNullptr) {
auto ret = umfPoolDestroy(nullptr);
ASSERT_EQ(ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
}

TEST_P(umfPoolTest, allocFree) {
static constexpr size_t allocSize = 64;
auto *ptr = umfPoolMalloc(pool.get(), allocSize);
Expand Down