Skip to content

Commit a622dc7

Browse files
authored
Merge pull request #1296 from npmiller/ba-destroyed
Check global state destruction in destructors
2 parents 4b1a946 + a2f13cd commit a622dc7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/memory_pool.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ static umf_result_t umfPoolCreateInternal(const umf_memory_pool_ops_t *ops,
115115
}
116116

117117
void umfPoolDestroy(umf_memory_pool_handle_t hPool) {
118+
if (umf_ba_global_is_destroyed()) {
119+
return;
120+
}
121+
118122
hPool->ops.finalize(hPool->pool_priv);
119123

120124
umf_memory_provider_handle_t hUpstreamProvider = NULL;

src/memory_provider.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ umf_result_t umfMemoryProviderCreate(const umf_memory_provider_ops_t *ops,
223223
}
224224

225225
void umfMemoryProviderDestroy(umf_memory_provider_handle_t hProvider) {
226-
if (hProvider) {
226+
if (hProvider && !umf_ba_global_is_destroyed()) {
227227
hProvider->ops.finalize(hProvider->provider_priv);
228228
umf_ba_global_free(hProvider);
229229
}

0 commit comments

Comments
 (0)