add alignment check to aligned_alloc for C11 compliance

This commit is contained in:
daan 2019-09-07 12:02:22 -07:00
parent 0aec6d9302
commit 7b63bc4211

View File

@ -71,6 +71,7 @@ void* mi_pvalloc(size_t size) mi_attr_noexcept {
}
void* mi_aligned_alloc(size_t alignment, size_t size) mi_attr_noexcept {
if (alignment != 0 && (size%alignment) != 0) return NULL; // C11 required; <https://en.cppreference.com/w/c/memory/aligned_alloc>
return mi_malloc_aligned(size, alignment);
}