]> git.proxmox.com Git - mirror_qemu.git/blobdiff - tests/libqos/malloc.c
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
[mirror_qemu.git] / tests / libqos / malloc.c
index 82b9df537a8293ff9b09b8c31f1d6fd2d4a0b968..b8eff5f495f6f858e73a47d3b1c929c94017f8b9 100644 (file)
  * See the COPYING file in the top-level directory.
  */
 
+#include "qemu/osdep.h"
 #include "libqos/malloc.h"
 #include "qemu-common.h"
-#include <stdio.h>
-#include <inttypes.h>
-#include <glib.h>
+#include "qemu/host-utils.h"
 
 typedef QTAILQ_HEAD(MemList, MemBlock) MemList;
 
@@ -270,6 +269,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);