Skip to content

Commit

Permalink
Merge pull request #4617 from gorevojd/free_bootstrapped_arena_crash
Browse files Browse the repository at this point in the history
Fixed crash in arena_free_all() for bootstrapped growing arenas.
  • Loading branch information
gingerBill authored Jan 6, 2025
2 parents 0cc1dbb + e82a0c8 commit 16acb34
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/mem/virtual/arena.odin
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ arena_free_all :: proc(arena: ^Arena, loc := #caller_location) {
}
// Zero the first block's memory
if arena.curr_block != nil {
mem.zero(arena.curr_block.base, int(arena.curr_block.used))
curr_block_used := int(arena.curr_block.used)
arena.curr_block.used = 0
mem.zero(arena.curr_block.base, curr_block_used)
}
arena.total_used = 0
case .Static, .Buffer:
Expand Down

0 comments on commit 16acb34

Please sign in to comment.