Chris Robinson (@kcat) commented about include/private/vkd3d_memory.h:
free(ptr);
}
+static inline void *vkd3d_malloc_aligned(size_t size, size_t alignment) +{
- /* aligned_alloc() requires C11. */
- void *p = malloc(size);
- /* Systems which support double-wide CAS should return a pointer with the required alignment. */
- if ((intptr_t)p & (alignment - 1))
This doesn't look safe. `malloc` is only required to return an alignment suitable for built-in POD types, but it may have a larger alignment depending on where it's able to find available memory, resulting in this spuriously succeeding or failing. If you can't use win32's `_aligned_malloc`/`_aligned_free`, or POSIX's `posix_memalign`, you may need to manually align with over-allocation.