aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bsd-user')
-rw-r--r--bsd-user/mmap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c
index 66233abc1..e916a6544 100644
--- a/bsd-user/mmap.c
+++ b/bsd-user/mmap.c
@@ -127,6 +127,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);