Handle zero size for posix_memalign. Return NULL or unique address

according to the 'V' option.

PR:	standards/138307
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2009-09-05 13:32:05 +00:00
parent 520998911a
commit 1ecc75dfe3

View File

@ -5320,6 +5320,15 @@ posix_memalign(void **memptr, size_t alignment, size_t size)
goto RETURN;
}
if (size == 0) {
if (opt_sysv == false)
size = 1;
else {
result = NULL;
ret = 0;
goto RETURN;
}
}
result = ipalloc(alignment, size);
}