aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNakst <nakst@protonmail.com>2021-03-14 20:36:35 +0000
committerGitHub <noreply@github.com>2021-03-14 20:36:35 +0000
commit0d1addf0d41e89d9f30ee70772df0938c7880a71 (patch)
tree0fff55ee0e9ede138e54248d0bc90560c182f1fe /src
parentf5142aaec41edbb85f9306216c6b199fa5adb7bb (diff)
Make size of allocation multiple of the alignment
To silence an error from GCC's address sanitizer.
Diffstat (limited to 'src')
-rw-r--r--src/gb/gb.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gb/gb.h b/src/gb/gb.h
index 687227dd3..b56c20f1e 100644
--- a/src/gb/gb.h
+++ b/src/gb/gb.h
@@ -5026,7 +5026,7 @@ GB_ALLOCATOR_PROC(gb_heap_allocator_proc) {
#elif defined(GB_SYSTEM_LINUX)
// TODO(bill): *nix version that's decent
case gbAllocation_Alloc: {
- ptr = aligned_alloc(alignment, size);
+ ptr = aligned_alloc(alignment, (size + alignment - 1) & ~(alignment - 1));
// ptr = malloc(size+alignment);
if (flags & gbAllocatorFlag_ClearToZero) {