From d19b89bdbd0a0e2b6be34f2bdbe27a3fe8a07428 Mon Sep 17 00:00:00 2001 From: Evgeny Kolesnikov Date: Mon, 18 Mar 2024 22:11:18 +0100 Subject: [PATCH] Fix warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/common/util.h:366:9: error: ignoring return value of 'posix_memalign’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result] --- src/common/util.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/util.h b/src/common/util.h index 8abe68d479..59a500d1f4 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -363,8 +363,10 @@ static inline void *oscap_aligned_malloc(size_t size, size_t alignment) { return _aligned_malloc(size, alignment); #else void *ptr = NULL; - posix_memalign(&ptr, alignment, size); - return ptr; + int ret = posix_memalign(&ptr, alignment, size); + if (ret == 0) + return ptr; + return NULL; #endif }