mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-18 11:22:11 +00:00
`base/runtime`: do not free the original block on a failed heap resize The default heap allocator freed old_ptr when the underlying allocation failed (allocated_mem == nil). On the realloc path (heap_resize) the original block is left intact on failure, and on the copy/fresh path old_ptr has not been copied or freed yet, so freeing it left the caller holding a dangling pointer. A [dynamic] array whose resize failed therefore double-freed its data on the next delete (reported as free(): invalid pointer / use-after-free). Return .Out_Of_Memory without freeing anything; the caller retains ownership of the original block. Fixes #7262