From 79e5ddaa265099f0e68040160a8e021248473e95 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Sat, 14 Jun 2025 07:50:30 -0400 Subject: [PATCH] mem: Make `stack_resize*` free if `size` is 0 This will cause an error if the memory being resized was not the last allocation, as should be expected according to the description that this "acts just like stack_free." --- core/mem/allocators.odin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin index 35d5a39ce..4002f6b17 100644 --- a/core/mem/allocators.odin +++ b/core/mem/allocators.odin @@ -1133,7 +1133,7 @@ stack_resize_bytes_non_zeroed :: proc( return stack_alloc_bytes_non_zeroed(s, size, alignment, loc) } if size == 0 { - return nil, nil + return nil, stack_free(s, old_memory, loc) } start := uintptr(raw_data(s.data)) end := start + uintptr(len(s.data))