summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util/oslib-posix.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index f5c401646f..d5dca4729a 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -88,6 +88,11 @@ void *qemu_oom_check(void *ptr)
void *qemu_memalign(size_t alignment, size_t size)
{
void *ptr;
+
+ if (alignment < sizeof(void*)) {
+ alignment = sizeof(void*);
+ }
+
#if defined(_POSIX_C_SOURCE) && !defined(__sun__)
int ret;
ret = posix_memalign(&ptr, alignment, size);