aboutsummaryrefslogtreecommitdiff
path: root/linux-user/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/mmap.c')
-rw-r--r--linux-user/mmap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index d0fc3e3d1a..888b491403 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -128,6 +128,8 @@ void *qemu_realloc(void *ptr, size_t size)
size_t old_size, copy;
void *new_ptr;
+ if (!ptr)
+ return qemu_malloc(size);
old_size = *(size_t *)((char *)ptr - 16);
copy = old_size < size ? old_size : size;
new_ptr = qemu_malloc(size);