diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h index 24d4a44..349b83f 100644 --- a/src/vk_mem_alloc.h +++ b/src/vk_mem_alloc.h @@ -1747,9 +1747,16 @@ remove them if not needed. #include void *aligned_alloc(size_t alignment, size_t size) { + // alignment must be >= sizeof(void*) + if(alignment < sizeof(void*)) + { + alignment = sizeof(void*); + } + void *pointer; - posix_memalign(&pointer, alignment, size); - return pointer; + if(posix_memalign(&pointer, alignment, size) == 0) + return pointer; + return VMA_NULL; } #endif