LibC: Fix posix_memalign return value

I was returning -1 with errno instead of the error code :P
This commit is contained in:
2026-07-16 10:07:43 +03:00
parent 7f25350c62
commit 8368dec30b

View File

@@ -424,12 +424,8 @@ void* aligned_alloc(size_t alignment, size_t size)
int posix_memalign(void** memptr, size_t alignment, size_t size)
{
if (alignment < sizeof(void*) || !BAN::Math::is_power_of_two(alignment))
{
errno = EINVAL;
return -1;
}
return (*memptr = aligned_alloc(alignment, size)) ? 0 : -1;
return EINVAL;
return (*memptr = aligned_alloc(alignment, size)) ? 0 : errno;
}
size_t malloc_usable_size(void* ptr)