Skip to content

Commit

Permalink
aligned_alloc: Permit alignment values smaller than sizeof(uintptr_t)
Browse files Browse the repository at this point in the history
posix_memalign() requires alignment values of at least
sizeof(uintptr_t), but aligned_alloc() does not.  memalign() regressed
to require larger alignment in commit
6cbc50f.

Fixes #668
  • Loading branch information
bsdjhb committed Aug 26, 2024
1 parent 6af38ac commit 15ae4b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/snmalloc/global/libc.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace snmalloc::libc
inline void* memalign(size_t alignment, size_t size)
{
if (SNMALLOC_UNLIKELY(
alignment < sizeof(uintptr_t) || !bits::is_pow2(alignment)))
alignment == 0 || !bits::is_pow2(alignment)))
{
return set_error(EINVAL);
}
Expand Down

0 comments on commit 15ae4b0

Please sign in to comment.