Skip to content

Commit

Permalink
Fix invalid pointer when malloc is not zero-filled.
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Aug 25, 2024
1 parent 8c8407c commit b7f76f4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/block_arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ void* block_arena::start(size_t wire_size) THROWS

size_t block_arena::detach() NOEXCEPT
{
set_link(nullptr);
memory_map_ = nullptr;
return total_ + offset_;
}
Expand Down Expand Up @@ -118,6 +117,9 @@ void block_arena::push(size_t minimum) THROWS
// Set previous chunk's link pointer to the new allocation.
set_link(map);
memory_map_ = map;

// Set current chunk's link pointer to nullptr.
set_link(nullptr);
total_ += offset_;
offset_ = link_size;
}
Expand Down

0 comments on commit b7f76f4

Please sign in to comment.