aboutsummaryrefslogtreecommitdiff
path: root/core/mem
diff options
context:
space:
mode:
authorFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-14 08:30:51 -0400
committerFeoramund <161657516+Feoramund@users.noreply.github.com>2025-06-14 13:21:14 -0400
commitc4f6e973d952fa626e6c8d201ae7be91bdf72c67 (patch)
tree8d7135c03a651117c4b72da7021300b6502d9215 /core/mem
parent62b0f7176853198b67c78503efcfb5ba27cfe755 (diff)
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.
Diffstat (limited to 'core/mem')
-rw-r--r--core/mem/allocators.odin4
1 files changed, 0 insertions, 4 deletions
diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin
index bcc9e21df..90a5c4943 100644
--- a/core/mem/allocators.odin
+++ b/core/mem/allocators.odin
@@ -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