mem: Don't change Scratch_Allocator's backup allocator

The backup allocator is set at `init` and must stay the same for the
lifetime of the Scratch allocator, as this allocator is used to free all
`leaked_allocations`. Changing it could lead to a situation where the
wrong allocator is used to free a leaked allocation.
This commit is contained in:
Feoramund
2025-06-14 08:30:51 -04:00
parent 62b0f71768
commit c4f6e973d9

View File

@@ -541,10 +541,6 @@ scratch_alloc_bytes_non_zeroed :: proc(
} else {
// NOTE: No need to use `aligned_size` here, as the backup allocator will handle alignment for us.
a := s.backup_allocator
if a.procedure == nil {
a = context.allocator
s.backup_allocator = a
}
ptr, err := alloc_bytes_non_zeroed(size, alignment, a, loc)
if err != nil {
return ptr, err