From a9961b7c70d69aa4cff4a36919e8dd58dbe399d2 Mon Sep 17 00:00:00 2001 From: Nicola Orlando Date: Fri, 1 Dec 2017 13:32:51 +0000 Subject: [PATCH] Reversed alignedMalloc return value. posix_memalign returns false on success; using == 0 instead of != 0 reverses it, allowing alignedMalloc to return true on success and false otherwise (mimicking what happens under Windows). --HG-- branch : Nixola/reversed-alignedmalloc-return-value-posi-1512135128149 --- src/common/memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/memory.cpp b/src/common/memory.cpp index ba18b3f89..c7d1515bc 100644 --- a/src/common/memory.cpp +++ b/src/common/memory.cpp @@ -38,7 +38,7 @@ bool alignedMalloc(void **mem, size_t size, size_t alignment) *mem = _aligned_malloc(size, alignment); return *mem != nullptr; #else - return posix_memalign(mem, alignment, size) != 0; + return posix_memalign(mem, alignment, size) == 0; #endif }