Fix memory leak in TempAllocator::free()

This commit is contained in:
uyzhang 2024-04-24 18:17:43 +08:00
parent 63022e143d
commit 82b3f99f51
1 changed files with 4 additions and 0 deletions

View File

@ -81,6 +81,10 @@ void TempAllocator::free(void* mem_ptr, size_t size, const size_t& allocation) {
auto it = cached_blocks.lower_bound(get_key(block));
if (it == cached_blocks.begin()) {
can_add = false;
underlying->free((void*)block->memory_ptr, block->size, 0);
unused_memory -= block->size;
block_ids.push_back(block->id);
delete block;
} else {
--it;
TempCachingBlock* block = it->second;