Merge pull request #2194 from mifreundorfer/fix-scratch-allocator

Handle freeing nil in scratch allocator
This commit is contained in:
Jeroen van Rijn
2022-11-14 22:04:00 +01:00
committed by GitHub
+3
View File
@@ -217,6 +217,9 @@ scratch_allocator_proc :: proc(allocator_data: rawptr, mode: Allocator_Mode,
return ptr, err
case .Free:
if old_memory == nil {
return nil, nil
}
start := uintptr(raw_data(s.data))
end := start + uintptr(len(s.data))
old_ptr := uintptr(old_memory)