Skip to content

Commit d19b89b

Browse files
committed
Fix warning
src/common/util.h:366:9: error: ignoring return value of 'posix_memalign’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
1 parent 5f1701b commit d19b89b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/common/util.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,10 @@ static inline void *oscap_aligned_malloc(size_t size, size_t alignment) {
363363
return _aligned_malloc(size, alignment);
364364
#else
365365
void *ptr = NULL;
366-
posix_memalign(&ptr, alignment, size);
367-
return ptr;
366+
int ret = posix_memalign(&ptr, alignment, size);
367+
if (ret == 0)
368+
return ptr;
369+
return NULL;
368370
#endif
369371
}
370372

0 commit comments

Comments
 (0)