Fix posix_memalign handling

Docs[1] says posix_memalign will return non-zero value if it failed
but currently it checked only if it's negative (or not) so that probably
it can triggers something wrong (e.g. core dumped) if something like ENOTMEM
returned.

Change-Id: I0b8883ea60a904d4dc0efef94a33946a44ecfe01
1: http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_memalign.html
This commit is contained in:
Kota Tsuyuzaki 2016-07-11 23:14:36 -07:00
parent 4a71b1d1a0
commit bdc8503bb2
1 changed files with 1 additions and 1 deletions

View File

@ -65,7 +65,7 @@ void *get_aligned_buffer16(int size)
* Ensure all memory is aligned to 16-byte boundaries
* to support 128-bit operations
*/
if (posix_memalign(&buf, 16, size) < 0) {
if (posix_memalign(&buf, 16, size) != 0) {
return NULL;
}