mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
mem: Check if alignment matches on Stack_Allocator resize
This commit is contained in:
@@ -1137,6 +1137,16 @@ stack_resize_bytes_non_zeroed :: proc(
|
|||||||
// NOTE(bill): Allow double frees
|
// NOTE(bill): Allow double frees
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
if uintptr(old_memory) & uintptr(alignment-1) != 0 {
|
||||||
|
// A different alignment has been requested and the current address
|
||||||
|
// does not satisfy it.
|
||||||
|
data, err := stack_alloc_bytes_non_zeroed(s, size, alignment, loc)
|
||||||
|
if err == nil {
|
||||||
|
runtime.copy(data, byte_slice(old_memory, old_size))
|
||||||
|
sanitizer.address_poison(old_memory)
|
||||||
|
}
|
||||||
|
return data, err
|
||||||
|
}
|
||||||
if old_size == size {
|
if old_size == size {
|
||||||
return byte_slice(old_memory, size), nil
|
return byte_slice(old_memory, size), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user