Skip to content

Commit

Permalink
Fix umf_ba_free() - do not assert on unknown pointer
Browse files Browse the repository at this point in the history
Ref: oneapi-src#903

Signed-off-by: Lukasz Dorau <[email protected]>
  • Loading branch information
ldorau committed Nov 18, 2024
1 parent 64456b7 commit 15ec788
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/base_alloc/base_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,11 @@ void umf_ba_free(umf_ba_pool_t *pool, void *ptr) {
umf_ba_chunk_t *chunk = (umf_ba_chunk_t *)ptr;

utils_mutex_lock(&pool->metadata.free_lock);
assert(pool_contains_pointer(pool, ptr));
if (!pool_contains_pointer(pool, ptr)) {
utils_mutex_unlock(&pool->metadata.free_lock);
return;
}

chunk->next = pool->metadata.free_list;
pool->metadata.free_list = chunk;
pool->metadata.n_allocs--;
Expand Down

0 comments on commit 15ec788

Please sign in to comment.