summaryrefslogtreecommitdiffstats
path: root/tests/libqos/malloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libqos/malloc.c')
-rw-r--r--tests/libqos/malloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c
index 82b9df5..19d05ca 100644
--- a/tests/libqos/malloc.c
+++ b/tests/libqos/malloc.c
@@ -270,6 +270,10 @@ uint64_t guest_alloc(QGuestAllocator *allocator, size_t size)
uint64_t rsize = size;
uint64_t naddr;
+ if (!size) {
+ return 0;
+ }
+
rsize += (allocator->page_size - 1);
rsize &= -allocator->page_size;
g_assert_cmpint((allocator->start + rsize), <=, allocator->end);
OpenPOWER on IntegriCloud