aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qemu-malloc.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/qemu-malloc.c b/qemu-malloc.c
index 676185786c..5e9f47f518 100644
--- a/qemu-malloc.c
+++ b/qemu-malloc.c
@@ -43,6 +43,8 @@ void qemu_free(void *ptr)
void *qemu_malloc(size_t size)
{
+ if (!size)
+ abort();
return oom_check(malloc(size));
}
@@ -50,8 +52,11 @@ void *qemu_realloc(void *ptr, size_t size)
{
if (size)
return oom_check(realloc(ptr, size));
- else
- return realloc(ptr, size);
+ else {
+ if (ptr)
+ return realloc(ptr, size);
+ }
+ abort();
}
void *qemu_mallocz(size_t size)