We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d0afb30 commit 5d3df2eCopy full SHA for 5d3df2e
1 file changed
MemoryPool.cpp
@@ -126,8 +126,11 @@ void CPPShift::Memory::MemoryPool::free(void* unit_pointer_start)
126
// If block offset is 0 remove block if not the only one left
127
if (this->currentBlock != this->firstBlock && (block->offset == 0 || block->numberOfAllocated == block->numberOfDeleted)) {
128
if (block == this->firstBlock) this->firstBlock = block->next;
129
- else block->prev->next = block->next;
130
- if (block == this->currentBlock) this->currentBlock = block->prev;
+ else if (block == this->currentBlock) this->currentBlock = block->prev;
+ else {
131
+ block->prev->next = block->next;
132
+ block->next->prev = block->prev;
133
+ }
134
std::free(block);
135
}
136
0 commit comments