From bdc8503bb2e24d7f70f13503dc440d8f9276268e Mon Sep 17 00:00:00 2001 From: Kota Tsuyuzaki Date: Mon, 11 Jul 2016 23:14:36 -0700 Subject: 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 --- src/erasurecode_helpers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/erasurecode_helpers.c b/src/erasurecode_helpers.c index 5068b27..40db93c 100644 --- a/src/erasurecode_helpers.c +++ b/src/erasurecode_helpers.c @@ -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; } -- cgit v1.2.1