diff options
-rw-r--r-- | qemu-malloc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/qemu-malloc.c b/qemu-malloc.c index 5d9e34d69d..6cdc5deb78 100644 --- a/qemu-malloc.c +++ b/qemu-malloc.c @@ -61,12 +61,10 @@ void *qemu_malloc(size_t size) void *qemu_realloc(void *ptr, size_t size) { - if (size) { - return oom_check(realloc(ptr, size)); - } else if (allow_zero_malloc()) { - return oom_check(realloc(ptr, size ? size : 1)); + if (!size && !allow_zero_malloc()) { + abort(); } - abort(); + return oom_check(realloc(ptr, size ? size : 1)); } void *qemu_mallocz(size_t size) |