On 2/27/22 02:54, Peter Maydell wrote:
+ if (size) {
+ ptr = _aligned_malloc(size, alignment);
+ } else {
+ ptr = NULL;
+ }
Oh, should we set errno to something here?
Otherwise a random value will be used by qemu_memalign.
Yeah, I guess so, though the errno to use isn't obvious. Maybe EINVAL?
The alternative would be to try to audit all the callsites to
confirm they don't ever try to allocate 0 bytes and then have
the assert for both Windows and POSIX versions...
Alternately, force size == 1, so that we always get a non-NULL value that can be freed.
That's a change on the POSIX side as well, of course.
r~