mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-04 20:17:48 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user