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:
parent
520998911a
commit
1ecc75dfe3
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user