it both malloc and aligned_alloc have been replaced but the internal
aligned_alloc still gets called, the replacement is a wrapper of some
sort. it's not clear if this usage should be officially supported, but
it's at least a plausibly interesting debugging usage, and easy to do.
it should not be relied upon unless it's documented as supported at
some later time.
return 0;
}
- if (len > SIZE_MAX - align || __malloc_replaced) {
+ if (len > SIZE_MAX - align ||
+ (__malloc_replaced && !__aligned_alloc_replaced)) {
errno = ENOMEM;
return 0;
}